Example configurations
Django on Apache
Put a file (named django_wsgi.py) in your project directory:
import os os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
Run the uwsgi server on a TCP socket
uwsgi --socket 127.0.0.1:3031 --pythonpath <path to your project directory> -w django_wsgi
or use the xml configuration:
<uwsgi> <socket>127.0.0.1:3031</socket> <pythonpath>path to your django project directory</pythonpath> <module>django_wsgi</module> </uwsgi>
uwsgi -x django.xml
Finally, add <Location> directive to apache configuration
<Location />
SetHandler uwsgi-script
uWSGISocket 127.0.0.1:3031
</Location>
Trac on apache in a sub-uri
Put this wsgi script (call it mytrac.py) in a dir in the pythonpath (or add the dir with the <pythonpath> directive)
import os
import trac.web.main
os.environ['TRAC_ENV'] = '<absolute_path_to_trac_project>'
applications = {'/trac':trac.web.main.dispatch_request}
Run the server
uwsgi -s /tmp/uwsgi.sock -C -w mytrac
Modify apache
<Location /trac>
SetHandler uwsgi-script
uWSGISocket /tmp/uwsgi.sock
</Location>
Web2Py
web2py does not work well on multiple application environment so you have to use it as the only WSGI application of the uWSGI server.
Use this wsgi script (look at the chdir call where you have to specify the app path):
import os
os.chdir("full_path_of_your_web2py_app")
import gluon.main
application = gluon.main.wsgibase
