[web2py] Re: web2py apache2 setup with htaccess authorization
Ah, thanks for the link and the example. I see some clues there. Regards, Chris On Monday, February 18, 2013 12:40:34 AM UTC+1, Massimo Di Pierro wrote: > > Perhaps this can help? > http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives > > Anyway you can mimic it with web2py. In a model add: > > if not session.authorized: > if request.post_vars.password == '123456': session.authorized = True > else: raise > HTTP(200,HTML(BODY(FORM('Password:',INPUT(_name='password'),INPUT(_type='submit'.xml()) > > > > On Sunday, 17 February 2013 13:22:20 UTC-6, Chr_M wrote: >> >> I understand it is a primitive system, but also a quick way to put a >> website behind a login. I do not want to integrate an authentication >> system, because it is only for some betatesters before the website goes >> live. >> >> On Sunday, February 17, 2013 4:25:16 PM UTC+1, Massimo Di Pierro wrote: >>> >>> Why do you want to use htaccess instead of web2py own authentication. >>> htaccess is such a primitive system. >>> >>> >>> On Sunday, 17 February 2013 06:26:09 UTC-6, Chr_M wrote: >>>> >>>> I come from a PHP background and when I wanted to have a website (or a >>>> part) behind a login screen (for example for beta testing) I could do that >>>> with a htaccess and htpasswd file (with Apache2). I have deployed a web2py >>>> website with Apache2, but I can not figure out how to have this website >>>> behind an Apache2 login. Is that possible with a web2py with Apache2 setup >>>> with a htaccess file? Or is there an alternative way to do in with web2py? >>>> >>>> Thanks in advance. >>>> >>>> Regards, Chris >>>> >>> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: web2py apache2 setup with htaccess authorization
I understand it is a primitive system, but also a quick way to put a website behind a login. I do not want to integrate an authentication system, because it is only for some betatesters before the website goes live. On Sunday, February 17, 2013 4:25:16 PM UTC+1, Massimo Di Pierro wrote: > > Why do you want to use htaccess instead of web2py own authentication. > htaccess is such a primitive system. > > > On Sunday, 17 February 2013 06:26:09 UTC-6, Chr_M wrote: >> >> I come from a PHP background and when I wanted to have a website (or a >> part) behind a login screen (for example for beta testing) I could do that >> with a htaccess and htpasswd file (with Apache2). I have deployed a web2py >> website with Apache2, but I can not figure out how to have this website >> behind an Apache2 login. Is that possible with a web2py with Apache2 setup >> with a htaccess file? Or is there an alternative way to do in with web2py? >> >> Thanks in advance. >> >> Regards, Chris >> > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] web2py apache2 setup with htaccess authorization
I come from a PHP background and when I wanted to have a website (or a part) behind a login screen (for example for beta testing) I could do that with a htaccess and htpasswd file (with Apache2). I have deployed a web2py website with Apache2, but I can not figure out how to have this website behind an Apache2 login. Is that possible with a web2py with Apache2 setup with a htaccess file? Or is there an alternative way to do in with web2py? Thanks in advance. Regards, Chris -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Code changes not honored (by web2py?)
Tried this at the top of db.py and at the top of my controller to no avail. (I replaced the 'from gluon.custom_import import track_changes; track_changes()' with your code). I guess the persistence of the instantiation is because the interpreter is started once when starting web2py webserver (maybe this does not occur when using apache2 or lighttpd?). On Wednesday, December 12, 2012 6:33:26 PM UTC+1, Massimo Di Pierro wrote: > > Instead of tack_changes() try this: > > from gluon.custom_import import custom_importer as __import__ > > On Wednesday, 12 December 2012 09:19:06 UTC-6, Chr_M wrote: >> >> Because I do not know the name of the module beforehand (it comes from a >> database). >> >> 'import class2' does not work either, I still need to reload() the >> module. I discovered also that the instantiation of class2 is persistant >> between requests when I do not reload the modules. I initialize a list in >> class1 and then add data from the database to this list. With every request >> the list grows with the same data from the database so I end up with a load >> of duplicate data in the list. I have to say that I am quite new to Python, >> so maybe this persistence is a Python thing... >> >> Regards, Chris >> >> >> On Wednesday, December 12, 2012 3:12:27 PM UTC+1, Massimo Di Pierro wrote: >>> >>> Why do you use __import__(class2) instead of >>> >>> import class2 >>> >>> If you do the latter, does track changes work? >>> >>> On Wednesday, 12 December 2012 01:33:41 UTC-6, Chr_M wrote: >>>> >>>> Python 2.7.3 >>>> Web2py 2.2.1 >>>> >>>> The situation: >>>> >>>> In modules directory I have a subdirectory with two files class1.py and >>>> class2.py. This is a package (empty __init__.py is present). class2.py >>>> imports class1.py and Class2 inherits from Class1. My controller >>>> dynamically imports class2 with the function __import__(class2). On top of >>>> my db.py model I call the track_changes part. The modules do not seem to >>>> be >>>> updated if I change code in class1.py or class2.py. >>>> >>>> I have solved it for now by reloading all the modules with reload() >>>> after I import them. So after I dynamically import class2 in my controller >>>> I call reload(class2). In class2.py after the import of class1 I call >>>> reload(class1). This is the only way I get the code changes to work in >>>> both >>>> files. >>>> >>>> It seems that the track_changes part is not working in this situation >>>> or something? Or is there another solution? >>>> >>>> Regards, Chris >>>> >>>> >>>> On Monday, December 10, 2012 4:34:33 PM UTC+1, Massimo Di Pierro wrote: >>>>> >>>>> It should work when you do it. >>>>> >>>>> Which python version? Which web2py version? >>>>> >>>>> On Monday, 10 December 2012 02:57:20 UTC-6, Chr_M wrote: >>>>>> >>>>>> I call this function at the top of my db.py model file. Is this not >>>>>> the correct location? >>>>>> >>>>>> Regards, Chris >>>>>> >>>>>> >>>>>> On Sunday, December 9, 2012 11:55:06 PM UTC+1, Massimo Di Pierro >>>>>> wrote: >>>>>>> >>>>>>> This has come up before. >>>>>>> >>>>>>> from gluon.custom_import import track_changes; track_changes() >>>>>>> >>>>>>> must be a model file, before the modules are imported, not in the >>>>>>> modules themselves which are otherwise cached and therefore the line >>>>>>> may or >>>>>>> may not be executed. >>>>>>> >>>>>>> Massimo >>>>>>> >>>>>>> On Sunday, 9 December 2012 15:34:09 UTC-6, Chr_M wrote: >>>>>>>> >>>>>>>> Sometimes the changes in the code of a module (in the modules >>>>>>>> directory) are not working when requesting the url that uses these >>>>>>>> modules. >>>>>>>> in the modules directory I have a subdirectory with python files that >>>>>>>> form >>>>>>>> a package (__init__.py file in this subdirectory). I have added >>>>>>>> >>>>>>>> from gluon.custom_import import track_changes >>>>>>>> track_changes() >>>>>>>> >>>>>>>> in the first model that gets called, but still sometimes code >>>>>>>> changes are not working. I noticed that the py-files in the modules >>>>>>>> dir get >>>>>>>> compiled to pyc-files. But at one point (it looks to be randomly) >>>>>>>> these are >>>>>>>> not compiled anymore when I change code in the py-files. But even when >>>>>>>> I >>>>>>>> remove these pyc-files, the code changes are still not working when >>>>>>>> requesting the url. >>>>>>>> >>>>>>>> Am I missing something? Is there a cache I can clear or something? >>>>>>>> I now have to restart web2py to make the code changes work... >>>>>>>> >>>>>>>> Thanks. >>>>>>>> >>>>>>>> Regards, Chris >>>>>>>> >>>>>>>> --
[web2py] Re: Code changes not honored (by web2py?)
Because I do not know the name of the module beforehand (it comes from a database). 'import class2' does not work either, I still need to reload() the module. I discovered also that the instantiation of class2 is persistant between requests when I do not reload the modules. I initialize a list in class1 and then add data from the database to this list. With every request the list grows with the same data from the database so I end up with a load of duplicate data in the list. I have to say that I am quite new to Python, so maybe this persistence is a Python thing... Regards, Chris On Wednesday, December 12, 2012 3:12:27 PM UTC+1, Massimo Di Pierro wrote: > > Why do you use __import__(class2) instead of > > import class2 > > If you do the latter, does track changes work? > > On Wednesday, 12 December 2012 01:33:41 UTC-6, Chr_M wrote: >> >> Python 2.7.3 >> Web2py 2.2.1 >> >> The situation: >> >> In modules directory I have a subdirectory with two files class1.py and >> class2.py. This is a package (empty __init__.py is present). class2.py >> imports class1.py and Class2 inherits from Class1. My controller >> dynamically imports class2 with the function __import__(class2). On top of >> my db.py model I call the track_changes part. The modules do not seem to be >> updated if I change code in class1.py or class2.py. >> >> I have solved it for now by reloading all the modules with reload() after >> I import them. So after I dynamically import class2 in my controller I call >> reload(class2). In class2.py after the import of class1 I call >> reload(class1). This is the only way I get the code changes to work in both >> files. >> >> It seems that the track_changes part is not working in this situation or >> something? Or is there another solution? >> >> Regards, Chris >> >> >> On Monday, December 10, 2012 4:34:33 PM UTC+1, Massimo Di Pierro wrote: >>> >>> It should work when you do it. >>> >>> Which python version? Which web2py version? >>> >>> On Monday, 10 December 2012 02:57:20 UTC-6, Chr_M wrote: >>>> >>>> I call this function at the top of my db.py model file. Is this not the >>>> correct location? >>>> >>>> Regards, Chris >>>> >>>> >>>> On Sunday, December 9, 2012 11:55:06 PM UTC+1, Massimo Di Pierro wrote: >>>>> >>>>> This has come up before. >>>>> >>>>> from gluon.custom_import import track_changes; track_changes() >>>>> >>>>> must be a model file, before the modules are imported, not in the >>>>> modules themselves which are otherwise cached and therefore the line may >>>>> or >>>>> may not be executed. >>>>> >>>>> Massimo >>>>> >>>>> On Sunday, 9 December 2012 15:34:09 UTC-6, Chr_M wrote: >>>>>> >>>>>> Sometimes the changes in the code of a module (in the modules >>>>>> directory) are not working when requesting the url that uses these >>>>>> modules. >>>>>> in the modules directory I have a subdirectory with python files that >>>>>> form >>>>>> a package (__init__.py file in this subdirectory). I have added >>>>>> >>>>>> from gluon.custom_import import track_changes >>>>>> track_changes() >>>>>> >>>>>> in the first model that gets called, but still sometimes code changes >>>>>> are not working. I noticed that the py-files in the modules dir get >>>>>> compiled to pyc-files. But at one point (it looks to be randomly) these >>>>>> are >>>>>> not compiled anymore when I change code in the py-files. But even when I >>>>>> remove these pyc-files, the code changes are still not working when >>>>>> requesting the url. >>>>>> >>>>>> Am I missing something? Is there a cache I can clear or something? I >>>>>> now have to restart web2py to make the code changes work... >>>>>> >>>>>> Thanks. >>>>>> >>>>>> Regards, Chris >>>>>> >>>>>> --
[web2py] Re: Code changes not honored (by web2py?)
Python 2.7.3 Web2py 2.2.1 The situation: In modules directory I have a subdirectory with two files class1.py and class2.py. This is a package (empty __init__.py is present). class2.py imports class1.py and Class2 inherits from Class1. My controller dynamically imports class2 with the function __import__(class2). On top of my db.py model I call the track_changes part. The modules do not seem to be updated if I change code in class1.py or class2.py. I have solved it for now by reloading all the modules with reload() after I import them. So after I dynamically import class2 in my controller I call reload(class2). In class2.py after the import of class1 I call reload(class1). This is the only way I get the code changes to work in both files. It seems that the track_changes part is not working in this situation or something? Or is there another solution? Regards, Chris On Monday, December 10, 2012 4:34:33 PM UTC+1, Massimo Di Pierro wrote: > > It should work when you do it. > > Which python version? Which web2py version? > > On Monday, 10 December 2012 02:57:20 UTC-6, Chr_M wrote: >> >> I call this function at the top of my db.py model file. Is this not the >> correct location? >> >> Regards, Chris >> >> >> On Sunday, December 9, 2012 11:55:06 PM UTC+1, Massimo Di Pierro wrote: >>> >>> This has come up before. >>> >>> from gluon.custom_import import track_changes; track_changes() >>> >>> must be a model file, before the modules are imported, not in the >>> modules themselves which are otherwise cached and therefore the line may or >>> may not be executed. >>> >>> Massimo >>> >>> On Sunday, 9 December 2012 15:34:09 UTC-6, Chr_M wrote: >>>> >>>> Sometimes the changes in the code of a module (in the modules >>>> directory) are not working when requesting the url that uses these >>>> modules. >>>> in the modules directory I have a subdirectory with python files that form >>>> a package (__init__.py file in this subdirectory). I have added >>>> >>>> from gluon.custom_import import track_changes >>>> track_changes() >>>> >>>> in the first model that gets called, but still sometimes code changes >>>> are not working. I noticed that the py-files in the modules dir get >>>> compiled to pyc-files. But at one point (it looks to be randomly) these >>>> are >>>> not compiled anymore when I change code in the py-files. But even when I >>>> remove these pyc-files, the code changes are still not working when >>>> requesting the url. >>>> >>>> Am I missing something? Is there a cache I can clear or something? I >>>> now have to restart web2py to make the code changes work... >>>> >>>> Thanks. >>>> >>>> Regards, Chris >>>> >>>> --
[web2py] Re: Code changes not honored (by web2py?)
No, I am not using Ajax callbacks. I have done some more research, but I could be a Python thing as well. http://stackoverflow.com/questions/437589/how-do-i-unload-reload-a-python-module http://stackoverflow.com/questions/2918898/prevent-python-from-caching-the-imported-modules The common most reliable answer seems to be to restart the python interpreter, thus to restart web2py webserver. Or is there a way web2py's webserver can automatically reload when code changes in modules (it seems Django does it that way)? Or has web2py solved this in another way? Regards, Chris On Monday, December 10, 2012 10:03:43 AM UTC+1, Lazarof wrote: > > Hi! > Are you using Ajax callback funcion? > > понедельник, 10 декабря 2012 г., 1:34:09 UTC+4 пользователь Chr_M написал: >> >> Sometimes the changes in the code of a module (in the modules directory) >> are not working when requesting the url that uses these modules. in the >> modules directory I have a subdirectory with python files that form a >> package (__init__.py file in this subdirectory). I have added >> >> from gluon.custom_import import track_changes >> track_changes() >> >> in the first model that gets called, but still sometimes code changes are >> not working. I noticed that the py-files in the modules dir get compiled to >> pyc-files. But at one point (it looks to be randomly) these are not >> compiled anymore when I change code in the py-files. But even when I remove >> these pyc-files, the code changes are still not working when requesting the >> url. >> >> Am I missing something? Is there a cache I can clear or something? I now >> have to restart web2py to make the code changes work... >> >> Thanks. >> >> Regards, Chris >> >> --
[web2py] Re: Code changes not honored (by web2py?)
I call this function at the top of my db.py model file. Is this not the correct location? Regards, Chris On Sunday, December 9, 2012 11:55:06 PM UTC+1, Massimo Di Pierro wrote: > > This has come up before. > > from gluon.custom_import import track_changes; track_changes() > > must be a model file, before the modules are imported, not in the modules > themselves which are otherwise cached and therefore the line may or may not > be executed. > > Massimo > > On Sunday, 9 December 2012 15:34:09 UTC-6, Chr_M wrote: >> >> Sometimes the changes in the code of a module (in the modules directory) >> are not working when requesting the url that uses these modules. in the >> modules directory I have a subdirectory with python files that form a >> package (__init__.py file in this subdirectory). I have added >> >> from gluon.custom_import import track_changes >> track_changes() >> >> in the first model that gets called, but still sometimes code changes are >> not working. I noticed that the py-files in the modules dir get compiled to >> pyc-files. But at one point (it looks to be randomly) these are not >> compiled anymore when I change code in the py-files. But even when I remove >> these pyc-files, the code changes are still not working when requesting the >> url. >> >> Am I missing something? Is there a cache I can clear or something? I now >> have to restart web2py to make the code changes work... >> >> Thanks. >> >> Regards, Chris >> >> --
[web2py] Code changes not honored (by web2py?)
Sometimes the changes in the code of a module (in the modules directory) are not working when requesting the url that uses these modules. in the modules directory I have a subdirectory with python files that form a package (__init__.py file in this subdirectory). I have added from gluon.custom_import import track_changes track_changes() in the first model that gets called, but still sometimes code changes are not working. I noticed that the py-files in the modules dir get compiled to pyc-files. But at one point (it looks to be randomly) these are not compiled anymore when I change code in the py-files. But even when I remove these pyc-files, the code changes are still not working when requesting the url. Am I missing something? Is there a cache I can clear or something? I now have to restart web2py to make the code changes work... Thanks. Regards, Chris --
Re: [web2py] Database table prefix
No, in some specific cases I can not create another db, because of restrictive permissions of client systems. In worst case I will have to search and replace prefixes in the files. I thought that maybe there is an easier solution that I did not know of. Thanks for all the suggestions! Regards, Chris On Monday, November 26, 2012 7:38:31 PM UTC+1, Richard wrote: > > You can't create more db? > > If you use postgres database, you could have look at schema, they serves > that purpose, and I am not sure but I think I read that web2py now support > postgres schemas. > > Richard > > On Fri, Nov 23, 2012 at 3:09 PM, Chr_M >wrote: > >> That, but even the same app using different tables in the same db (but >> for different cliënts)... >> >> Regards, Chris >> >> >> >> On Friday, November 23, 2012 7:00:28 PM UTC+1, Richard wrote: >> >>> Why exactly you change prefix? Installing differents apps dbs in the >>> same db? >>> >>> Richard >>> >>> >>> On Fri, Nov 23, 2012 at 10:57 AM, Chr_M wrote: >>> >>>> Hi, >>>> >>>> I am new to web2py and am migrating an application to web2py. All the >>>> tables have a prefix that changes for the different deployments of the >>>> application. Is there a way in web2py to have a prefix for all the tables >>>> in the database that I can change easely for different deployments? >>>> >>>> At this time I use a >>>> >>>> PREFIX = 'prefix_' >>>> >>>> constant and define tables with >>>> >>>> db.define_table(PREFIX + 'table_name', etc... >>>> >>>> but this is becoming a bit complicated when defining requirements etc. >>>> Maybe there is an easier solution? >>>> >>>> Thanks in advance. >>>> >>>> Regards, Chris >>>> >>>> -- >>>> >>>> >>>> >>>> >>> >>> -- >> >> >> >> > > --
Re: [web2py] Database table prefix
Well, ideal for me would be to define a prefix in the model file and this is automatically added to every defined table and all queries (no idea if it is possible). But this multi-tenancy looks interesting as well, so I will look into it... Thanks! Regards, Chris On Monday, November 26, 2012 4:17:57 PM UTC+1, Anthony wrote: > > Do you have a proposal for how an easier implementation should work? > > Also, rather than separate tables for different clients, have you > considered either > multi-tenancy<http://web2py.com/books/default/chapter/29/06#Common-fields-and-multi-tenancy>or > just using separate databases (in the latter case, you could just define > the DAL connection string dynamically to refer to the appropriate database)? > > Anthony > > On Monday, November 26, 2012 10:09:18 AM UTC-5, Chr_M wrote: >> >> I guess that nobody has ever had a need for this and that there is not >> really a solution for it? >> >> Regards, Chris >> >> >> On Friday, November 23, 2012 9:09:24 PM UTC+1, Chr_M wrote: >>> >>> That, but even the same app using different tables in the same db (but >>> for different cliënts)... >>> >>> Regards, Chris >>> >>> >>> On Friday, November 23, 2012 7:00:28 PM UTC+1, Richard wrote: >>>> >>>> Why exactly you change prefix? Installing differents apps dbs in the >>>> same db? >>>> >>>> Richard >>>> >>>> On Fri, Nov 23, 2012 at 10:57 AM, Chr_M wrote: >>>> >>>>> Hi, >>>>> >>>>> I am new to web2py and am migrating an application to web2py. All the >>>>> tables have a prefix that changes for the different deployments of the >>>>> application. Is there a way in web2py to have a prefix for all the tables >>>>> in the database that I can change easely for different deployments? >>>>> >>>>> At this time I use a >>>>> >>>>> PREFIX = 'prefix_' >>>>> >>>>> constant and define tables with >>>>> >>>>> db.define_table(PREFIX + 'table_name', etc... >>>>> >>>>> but this is becoming a bit complicated when defining requirements etc. >>>>> Maybe there is an easier solution? >>>>> >>>>> Thanks in advance. >>>>> >>>>> Regards, Chris >>>>> >>>>> -- >>>>> >>>>> >>>>> >>>>> >>>> >>>> --
Re: [web2py] Database table prefix
I guess that nobody has ever had a need for this and that there is not really a solution for it? Regards, Chris On Friday, November 23, 2012 9:09:24 PM UTC+1, Chr_M wrote: > > That, but even the same app using different tables in the same db (but for > different cliënts)... > > Regards, Chris > > > On Friday, November 23, 2012 7:00:28 PM UTC+1, Richard wrote: >> >> Why exactly you change prefix? Installing differents apps dbs in the same >> db? >> >> Richard >> >> On Fri, Nov 23, 2012 at 10:57 AM, Chr_M wrote: >> >>> Hi, >>> >>> I am new to web2py and am migrating an application to web2py. All the >>> tables have a prefix that changes for the different deployments of the >>> application. Is there a way in web2py to have a prefix for all the tables >>> in the database that I can change easely for different deployments? >>> >>> At this time I use a >>> >>> PREFIX = 'prefix_' >>> >>> constant and define tables with >>> >>> db.define_table(PREFIX + 'table_name', etc... >>> >>> but this is becoming a bit complicated when defining requirements etc. >>> Maybe there is an easier solution? >>> >>> Thanks in advance. >>> >>> Regards, Chris >>> >>> -- >>> >>> >>> >>> >> >> --
Re: [web2py] Database table prefix
That, but even the same app using different tables in the same db (but for different cliënts)... Regards, Chris On Friday, November 23, 2012 7:00:28 PM UTC+1, Richard wrote: > > Why exactly you change prefix? Installing differents apps dbs in the same > db? > > Richard > > On Fri, Nov 23, 2012 at 10:57 AM, Chr_M >wrote: > >> Hi, >> >> I am new to web2py and am migrating an application to web2py. All the >> tables have a prefix that changes for the different deployments of the >> application. Is there a way in web2py to have a prefix for all the tables >> in the database that I can change easely for different deployments? >> >> At this time I use a >> >> PREFIX = 'prefix_' >> >> constant and define tables with >> >> db.define_table(PREFIX + 'table_name', etc... >> >> but this is becoming a bit complicated when defining requirements etc. >> Maybe there is an easier solution? >> >> Thanks in advance. >> >> Regards, Chris >> >> -- >> >> >> >> > > --
[web2py] Database table prefix
Hi, I am new to web2py and am migrating an application to web2py. All the tables have a prefix that changes for the different deployments of the application. Is there a way in web2py to have a prefix for all the tables in the database that I can change easely for different deployments? At this time I use a PREFIX = 'prefix_' constant and define tables with db.define_table(PREFIX + 'table_name', etc... but this is becoming a bit complicated when defining requirements etc. Maybe there is an easier solution? Thanks in advance. Regards, Chris --