Sorry if this was already discussed, I did search the group and did not find 
anything similar.

I just started looking into Pylons.  I installed it, then installed wsgi 3.1 
and I am going thru the excellent Pylons book 
http://pylonsbook.com/en/1.1/index.html.  All examples worked fine until I got 
to the app_globals_test in ch.3 
(http://pylonsbook.com/en/1.1/exploring-pylons.html#serving-a-pylons-application,
 search for App Globals Object).  This works fine under the paster serve cmd or 
under the simple server but under the wsgi the visits counter does not increase.

In that example the application's lib/app_globals.py Globals class is 
instantiated in the config/environment.py module where the self.visits is set 
to 0, then the instance is used in the controllers/hello.py module to increment 
the visits.  The trouble is, the way it works in my apache setup, both the 
enviroments.py and the hello.py modules are called on every access to the URL 
http://localhost:8800/hello/app_globals_test, so the counter stays at 1.  Is 
there a way to avoid running the configuration modules on every access?

Here is my apache config wsgi.conf

# virtual Python-Pylons environment
WSGIPythonHome /u0/home/vshkolni/performance/pyl

Listen 8800
NameVirtualHost *:8800
<VirtualHost *:8800>

    # Logfiles
    ErrorLog logs/wsgi-error_log
    CustomLog logs/wsgi-access_log common

    # Setup mod_wsgi
    WSGIScriptAlias / /var/www/wsgi/dispatch.wsgi

    DocumentRoot /var/www/wsgi
    <Directory /var/www/wsgi>
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>

And this is the dispatch.wsgi

# Add the virtual Python environment site-packages directory to the path
import site
site.addsitedir('/u0/home/vshkolni/performance/pyl/lib/python2.6/site-packages')
import sys
sys.path.append('/u0/home/vshkolni/performance/HelloWorld')

# Keep cache in Pylons dir
import os
os.environ['PYTHON_EGG_CACHE'] = '/var/www/wsgi/pylons/egg-cache'

# Load the Pylons application
from paste.deploy import loadapp
application = 
loadapp('config:/u0/home/vshkolni/performance/HelloWorld/development.ini')

--

You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.


Reply via email to