Django's URL regex engine is failing

2019-08-27 20:15发布

Django's URL regex engine is failing and I have no idea why. Even my sanity checks are failing horribly.

Here's my urls.py:

from django.conf.urls import patterns, include, url

urlpatterns = patterns('',
    url(r'^a', 'placemyorder.views.home', name='home'),
)

I get this 404 error:

Page not found (404)
Request Method: GET
Request URL:    http://[ip address]/a/
Using the URLconf defined in placemyorder.urls, Django tried these URL patterns, in this order:
1. ^a [name='home']
The current URL, , didn't match any of these.

when I visit

http://[ip address]/a

And it's hosted on Django 1.5.2 with Python 2.7.3 on Ubuntu 12.04 behind nginx if that info is relevant.

1条回答
Evening l夕情丶
2楼-- · 2019-08-27 20:56

Here's a clue: The current URL, , didn't match any of these.

It should say: The current URL, http://[ip address]/a, didn't match any of these.

So the dispatcher isn't getting the request url.

Take a look at this solution:
Django + NGINX URL Problem

查看更多
登录 后发表回答