I'm trying to setup django under some suburl, lets say /myproject
, with nginx and uwsgi. However, I can't get it working. Whatever I try, seems that uwsgi_modifier1 30;
option doesn't work. I always get doubled path, instead of localhost:8000/myproject
, I get localhost:8000/myproject/myproject
What am I missing? Here are the relevant files:
Django urls.py
from django.conf.urls import patterns, include, url
from django.http import HttpResponse
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', lambda x: HttpResponse('Hello world'), name='home'),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)
I didn't change anything in default django settings.py, except adding DB info. And here is nginx conf file:
upstream mydjango {
server unix:///home/username/www/myproject/c.sock;
}
server {
listen 8000;
server_name localhost;
location /myproject/ {
uwsgi_pass mydjango;
include /home/username/www/myproject/uwsgi_params;
uwsgi_param SCRIPT_NAME /myproject;
uwsgi_modifier1 30;
}
}
and I'm starting uwsgi from command line for now with:
uwsgi --socket c.sock --module myproject.wsgi --chmod-socket=666
I don't find any errors in the logs, just 404, because there is no nginx conf for path /
on 8000
port, but there is no django
url rule to match /myproject/myproject/
either. So where is my mistake? If that is relevant, I'm trying this on debian wheezy, nginx the latest from mainline, python-3.3.2