wiki:ApplicationsDict

Configure the uWSGI server using only python

You can avoid the use of the xml file for configuring the applications and rely on python only:

import uwsgi
import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

def myapp(environ, start_response):
        start_response('200 OK', [('Content-Type', 'text/plain')])
        yield 'Hello World\n'



uwsgi.applications = {'':application, '/django':'application', '/myapp':myapp}

Passing the python module name (without the .py extension) to the -w option of uWSGI, it will search the uwsgi.applications dictionary for the url/callable mappings.

The value of every item can be the function/callable string representation or the object itself.