> > Hello everyone. > I tried to serve Django app and Mercurial repo web directory with one > uWSGI instance just like documentation says > (http://projects.unbit.it/uwsgi/wiki/Example#DjangoandMercurialjustmarried). > I see both apps registered as uWSGI starts: > > > ...getting the applications list from the 'uwsgi_config_file' module... > application 0 () ready > setting default application to 0 > application 1 (/hg) ready > > But really works only application bound to root url ('/'). That is, if > Django is bound to '/' (or empty string, ''), /hg is passed to it by > uWSGI, and Django app returns 404, of course. In case of "reversed" > binding {'': hgwebdir application, '/django': djangoapp} Mercurial repos > are served fine, but request for '/django' returns 404 "No repo found". > > That's how I start uWSGI (0.9.6.6, Gentoo Linux amd64, Python 2.7.1, > everything compiled with GCC 4.5.1): > % /usr/bin/uwsgi -s 127.0.0.1:60150 --file > /home/sterkrig/projects/uwsgi.py > > And `uwsgi.py` is taken just from documentation (with mercurial imports > fixed): > > ------- > import sys, uwsgi > sys.path.append('/home/sterkrig/projects') > > from mercurial.hgweb.hgwebdir_mod import hgwebdir > > hgapp = hgwebdir('/home/sterkrig/projects/hgweb.config') > > import os > os.environ['DJANGO_SETTINGS_MODULE'] = 'webgen.settings' > > import django.core.handlers.wsgi > djangoapp = django.core.handlers.wsgi.WSGIHandler() > > uwsgi.applications = {'': djangoapp, '/hg': hgapp} > ------- > > Do I miss something here? Looks like Documentation isn't quite correct > or?.. > >
>From the uWSGI side the configuration is perfect. The problem is with SCRIPT_NAME Pratically, to choose between apps uWSGI looks at the SCRIPT_NAME variable. In your case it always contains '/'. To fix this you have to add a second directory in your virtual server (called /hg) that point to the same uWSGI source. O.T. I found this way of configure multiple apps a real PITA, so in the current mercurial tip you can avoid managing SCRIPT_NAME in the webserver and let uWSGI do the dirty work.Simply add the --manage-script-name directive -- Roberto De Ioris http://unbit.it _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
