我知道这听起来像是一个愚蠢的问题,但我知道是否需要重新编译 Python 代码或者由处理 Python 代码的服务器完成(绑定/渲染)?
我问你是因为我已经开始了一个示例项目,并且在向页面添加链接时出现“找不到页面”(404 错误)
Using the URLconf defined in httpi.urls, Django tried these URL patterns, in this order:
^$
^piface/
The current URL, mypage.html, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
Python 代码如下所示:
from django.conf.urls import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'httpi.views.index'),
url(r'^/mypage.html', 'httpi.views.index'),
url(r'^piface/', include('httpiface.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
# url(r'^admin/', include(admin.site.urls)),
)