Example configurations
Django
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()
substitute mysite with your project name
Prepare the uwsgi config file:
<uwsgi>
<pythonpath>/path to your project directory</pythonpath>
<app mountpoint="/">
<script>django_wsgi</script>
</app>
</uwsgi>
Set the <pythonpath> directive to the absolute path of the django project
Run the uwsgi server on the default socket
uwsgi -s /tmp/uwsgi.sock -C -x <path_to_uwsgi_config_file>
or use the python-only configuration:
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
applications = {'/': application }
uwsgi -s /tmp/uwsgi.sock -C -x <path_to_wsgi_script>
Finally, add <Location> directive to apache configuration
<Location />
SetHandler uwsgi-script
</Location>
Trac
Put this wsgi script 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>' application = trac.web.main.dispatch_request
Configure uwsgi
<uwsgi>
<app mountpoint="/trac">
<script>trac_wsgi</script>
</app>
</uwsgi>
Run the server
uwsgi -s /tmp/uwsgi.sock -C -x <path_to_uwsgi_config_file>
Modify apache
<Location /trac>
SetHandler uwsgi-script
</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
