I am setting up a login system for a Django site, which is running on an Nginx server. I'm getting the following debug 404 page:
Using the URLconf defined in it.urls, Django tried these URL patterns, in this order:
^admin/
^login/ [name='main_login']
^$ [name='index']
^laptops/
^assets/
^mardes/
^users/
^jobs/
^static\/(?P<path>.*)$
The current URL, account/login/, didn't match any of these.
This appears to be using an old version of the it.urls file; the current one looks like this:
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls) ),
url(r'^account/', include('account.urls', namespace='account'), name='account' ),
url(r'^laptops/', include('laptops.urls', namespace='laptops') ),
url(r'^assets/', include('assets.urls', namespace='assets') ),
url(r'^mardes/', include('mardes.urls', namespace='mardes') ),
url(r'^users/', include('users.urls', namespace='users') ),
url(r'^jobs/', include('jobs.urls', namespace='jobs') ),
url(r'^', TemplateView.as_view(template_name='it/index.html'), name='index' ),
) + staticfiles_urlpatterns()
Which, as you can see, has no r'^login/' pattern.
I have set LOGIN_URL to '/account/login/' in my settings.py file, however the @login_required decorator is loading '/login/'. The new url is also ignored when I specify login_url='/account/login' in the @login_required call.
I have restarted Nginx (both by starting and stopping, and running 'restart'), this has made no different. I have also set 'sendfile=off' in the nginx.conf file. I am guessing there is cache stored somewhere (re: How to clear the cache of nginx?).
Please let me know if you need more details.