You are running in a multi process configuration, specifically embedded mode.

Suggest you use embedded mode with a single process.

Some related reading:

http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
http://blog.dscpl.com.au/2012/10/why-are-you-using-embedded-mode-of.html

Also see notes below.


On 06/08/2014, at 5:33 AM, Shatskiy Kirill <[email protected]> wrote:

> Hello!
> Accodrding to example on http://webpy.org/cookbook/mod_wsgi-apache I tried to 
> build test application 
> and configure apache. I have problem with sessions, they seem not working 
> because counter isn't incremented 
> when I request /count page. Also, I tried to use DBStore instead of DiskStore 
> and got the same result.
> I assume that problem somewhere in Apache. In default Apache 2.2. config I'd 
> just change site-availiable/default. 
> 
> Apache 2.2, webpy 0.37, latest mod_wsgi and Ubuntu 12.04
> 
> ---------code.py----------
> import web
> import os
> 
> urls = (
> 
> '/count', 'count',
> '/reset', 'reset'
> 
> )
> 
> web.config.debug = False
> app = web.application(urls, globals())
> curdir = os.path.dirname(__file__)
> session = web.session.Session(app, 
> web.session.DiskStore(os.path.join(curdir,'sessions')),initializer = 
> {'counter': 0})
> 
> application = app.wsgifunc()
> 
> class count:
>     def GET(self):
>         session.counter += 1
>         return str(session.counter)
> 
> class reset:
>     def GET(self):
>         session.kill()
>         return ""
> 
> -------Apache config-------------
> 
> <VirtualHost *:80>
> 
>         DocumentRoot /var/www/webpy-app/

It is bad security practice to set DocumentRoot to be a parent directory of 
where your source code resides. If you were to comment out the WSGIScriptAlias 
accidentally, people could download your code.

>         WSGIScriptAlias / /var/www/webpy-app/code.py/

Don't add a trailing slash to WSGI script file path.

>         Alias /appname/static /var/www/webpy-app/static/

When mapping a sub URL alias, ensure the trailing slashes are balance. That is, 
on both, or not on either.

  Alias /appname/static /var/www/webpy-app/static

>         AddType text/html .py

Not good to rely on this. Your web application should really set the response 
content type itself to be portable to other WSGI servers.

>         <Directory /var/www/webpy-app/>
>             Order deny,allow
>             Allow from all
>         </Directory>
> 
>        ErrorLog ${APACHE_LOG_DIR}/error.log
> 
>        # Possible values include: debug, info, notice, warn, error, crit,
>        # alert, emerg.
>        LogLevel debug
> 
>        CustomLog ${APACHE_LOG_DIR}/access.log combined
> 
> </VirtualHost>
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to