From: Bruce W. <bru...@fa...> - 2006-02-24 16:03:15
|
I've created a Spyce application at work. It's relatively simple; it displays a table listing current projects, and provides a form for adding new projects and editing current projects. The application is running on a Windows 2000 server, running Apache 2.0.55 and Python 2.4. The Spyce version is 2.0.3.1. I've configured it to use mod_python (version 3.2.5b). The project information is stored in an Oracle 9i database - I'm using cx_Oracle 4.1 to connect to Oracle. I have two versions of the application on the server, one for production and one for development. Each version has a configuration file called isdPrjConfig.py which contains the name of the database, id, password, and other environment-specific settings. (There are files for each environment - isdPrjConfig.dev.py and isdPrjConfig.prod.py - and the appropriate file is copied over isdPrjConfig.py.) The problem is that one of these configuration files gets cached and is used for both environments. If I restart Apache, the first config file to be accessed is then used for both directories. I'm able to find information on Apache caching, but since these files are in different folders, I don't think that applies. Here are some more details. ----- >From httpd.conf: # Spyce via mod_python (added by Bruce Webber, 2006-02-02) <IfModule mod_python.c> AddHandler python-program .spy PythonHandler run_spyceModpy::spyceMain PythonPath "sys.path+[r'c:/spyce']" #PythonOption SPYCE_CONFIG "/mydir/spyceconf.py" #PythonOptimize On </IfModule> ScriptInterpreterSource registry # ISD Project Info application (added by Bruce Webber, 2006-02-03) Alias /isdprjinfo/ "c:/spycesites/isdprjinfo/www/" <Directory "c:/spycesites/isdprjinfo/www/"> Options Indexes AllowOverride None Order allow,deny Allow from all </Directory> # ISD Project Info application - Development (added by Bruce Webber, 2006-02-16) Alias /isdprjinfo-dev/ "c:/spycesites/isdprjinfo-dev/www/" <Directory "c:/spycesites/isdprjinfo-dev/www/"> Options Indexes AllowOverride None Order allow,deny Allow from all </Directory> ----- The production isdPrjConfig.py file (with sensitive details changed): # database properties DB_NAME = 'proddatabase' DB_USER = 'user' DB_PSWD = 'password' # if false, the user ID is not checked (for development) CHECK_USER_ID = True # if true, the SQL and exception details will be displayed SQL_DEBUG = False ----- If more information is needed, or if I should direct this question to another list, please let me know. Thanks, -- Bruce Webber bru...@fa... http://brucewebber.us |
From: Jonathan E. <jon...@ca...> - 2006-02-25 19:47:52
|
This is a fundamental effect of the mod_python architecture. That is, since mod_python creates a certain number of long-running Python processes, the normal Python behavior is exhibited that for each "import foo" statement, foo.py is located once and its location cached for subsequent imports. Your options include, in order of increasing difficulty, 1) use the built-in Spyce server for development instead of apache + mod_python 2) run a separate apache server for development 3) rather than using the built-in import, use the imp module to manually force the loading, each time, of the module you want -Jonathan On Fri, 24 Feb 2006 11:02:58 -0500, "Bruce Webber" <bru...@fa...> said: > I've created a Spyce application at work. It's relatively simple; it > displays a table listing current projects, and provides a form for adding > new projects and editing current projects. > > The application is running on a Windows 2000 server, running Apache > 2.0.55 > and Python 2.4. The Spyce version is 2.0.3.1. I've configured it to use > mod_python (version 3.2.5b). The project information is stored in an > Oracle > 9i database - I'm using cx_Oracle 4.1 to connect to Oracle. > > I have two versions of the application on the server, one for production > and one for development. Each version has a configuration file called > isdPrjConfig.py which contains the name of the database, id, password, > and > other environment-specific settings. (There are files for each > environment > - isdPrjConfig.dev.py and isdPrjConfig.prod.py - and the appropriate file > is copied over isdPrjConfig.py.) > > The problem is that one of these configuration files gets cached and is > used for both environments. If I restart Apache, the first config file to > be accessed is then used for both directories. > > I'm able to find information on Apache caching, but since these files are > in different folders, I don't think that applies. > > Here are some more details. > > ----- > >From httpd.conf: > > # Spyce via mod_python (added by Bruce Webber, 2006-02-02) > <IfModule mod_python.c> > AddHandler python-program .spy > PythonHandler run_spyceModpy::spyceMain > PythonPath "sys.path+[r'c:/spyce']" > #PythonOption SPYCE_CONFIG "/mydir/spyceconf.py" > #PythonOptimize On > </IfModule> > ScriptInterpreterSource registry > > # ISD Project Info application (added by Bruce Webber, 2006-02-03) > Alias /isdprjinfo/ "c:/spycesites/isdprjinfo/www/" > <Directory "c:/spycesites/isdprjinfo/www/"> > Options Indexes > AllowOverride None > Order allow,deny > Allow from all > </Directory> > > # ISD Project Info application - Development (added by Bruce Webber, > 2006-02-16) > Alias /isdprjinfo-dev/ "c:/spycesites/isdprjinfo-dev/www/" > <Directory "c:/spycesites/isdprjinfo-dev/www/"> > Options Indexes > AllowOverride None > Order allow,deny > Allow from all > </Directory> > > ----- > The production isdPrjConfig.py file (with sensitive details changed): > > # database properties > DB_NAME = 'proddatabase' > DB_USER = 'user' > DB_PSWD = 'password' > > # if false, the user ID is not checked (for development) > CHECK_USER_ID = True > > # if true, the SQL and exception details will be displayed > SQL_DEBUG = False > > ----- > > If more information is needed, or if I should direct this question to > another list, please let me know. > > Thanks, > > -- > Bruce Webber > bru...@fa... > http://brucewebber.us > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting > language > that extends applications into web and mobile media. Attend the live > webcast > and join the prime developer group breaking into this new coding > territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Spyce-users mailing list > Spy...@li... > https://lists.sourceforge.net/lists/listinfo/spyce-users -- C++ is history repeated as tragedy. Java is history repeated as farce. --Scott McKay |
From: Bruce W. <bru...@fa...> - 2006-02-25 21:47:10
|
--Jonathan Ellis <jon...@ca...> wrote: > This is a fundamental effect of the mod_python architecture. That is, > since mod_python creates a certain number of long-running Python > processes, the normal Python behavior is exhibited that for each "import > foo" statement, foo.py is located once and its location cached for > subsequent imports. > > Your options include, in order of increasing difficulty, > > 1) use the built-in Spyce server for development instead of apache + > mod_python Thanks, Jonathan. So I could run apache + mod_python (port 80) for production, along with the built in Spyce server (port 8000) for development on the same server? This would be perfect. (BTW, the reason I'm running mod_python is because I have Moin, along with static pages, and I could not get fast_cgi running under Apache.) > 2) run a separate apache server for development > 3) rather than using the built-in import, use the imp module to manually > force the loading, each time, of the module you want > > -Jonathan > > On Fri, 24 Feb 2006 11:02:58 -0500, "Bruce Webber" > <bru...@fa...> said: >> I've created a Spyce application at work. It's relatively simple; it >> displays a table listing current projects, and provides a form for >> adding new projects and editing current projects. [...] >> I have two versions of the application on the server, one for production >> and one for development. Each version has a configuration file called >> isdPrjConfig.py which contains the name of the database, id, password, >> and >> other environment-specific settings. (There are files for each >> environment >> - isdPrjConfig.dev.py and isdPrjConfig.prod.py - and the appropriate >> file is copied over isdPrjConfig.py.) >> >> The problem is that one of these configuration files gets cached and is >> used for both environments. If I restart Apache, the first config file >> to be accessed is then used for both directories. [...] -- Bruce Webber bru...@fa... http://brucewebber.us |
From: Jonathan E. <jon...@ca...> - 2006-02-26 04:20:02
|
On Sat, 25 Feb 2006 16:47:01 -0500, "Bruce Webber" <bru...@fa...> said: > --Jonathan Ellis <jon...@ca...> wrote: > > > This is a fundamental effect of the mod_python architecture. That is, > > since mod_python creates a certain number of long-running Python > > processes, the normal Python behavior is exhibited that for each "import > > foo" statement, foo.py is located once and its location cached for > > subsequent imports. > > > > Your options include, in order of increasing difficulty, > > > > 1) use the built-in Spyce server for development instead of apache + > > mod_python > > Thanks, Jonathan. > > So I could run apache + mod_python (port 80) for production, along with > the > built in Spyce server (port 8000) for development on the same server? > This > would be perfect. That should work just fine. -Jonathan -- C++ is history repeated as tragedy. Java is history repeated as farce. --Scott McKay |