我有以下网址模式:
urlpatterns = patterns('',
url(r'^$', 'opeiaa.views.home', name='home'),
url(r'^store/$', 'opeiaa.views.store', name='store'),
url(r'^resume/$', 'opeiaa.views.resume', name='resume'),
url(r'^contact/$', 'opeiaa.views.contact', name='contact'),
url(r'^gallery/', include('gallery.urls')),
url(r'^admin/', include(admin.site.urls)),
)
...并且正在使用这种模板标签:
<a class='nav-link' href='{% url 'contact' %}'>Contact</a>
URL 在页面中呈现为http://localhost:8000/contact/
. 一切正常,./manage.py runserver
用于测试时...
...但随后我运行./manage.py runfcgi
- 然后当我导航到联系页面时,导航中的 URL 指向http://localhost:8000/contact/contact/
!我尝试在开头添加一个斜杠以使 URL 成为绝对 URL,但是没有它,URL 似乎是绝对的。
我使用 nginx 作为前端,相关的配置是:
location / {
include fastcgi_params;
fastcgi_pass unix:/tmp/django.sock;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_pass_header Authorization;
fastcgi_intercept_errors off;
}
我正在使用 Django 1.6 和 Python 2.7.4。任何人有任何见解?