Re: Spyce application config file issue

"Jonathan Ellis" <[email protected]>
Newsgroups gmane.comp.python.spyce.general
Message-ID <[email protected]>
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"
<[email protected]> 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
> [email protected]
> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/spyce-users
-- 
C++ is history repeated as tragedy. Java is history repeated as farce.  --Scott McKay



-------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.