包含的urlconf中没有任何模式+ django

时间:2014-05-15 06:45:54

标签: python django url urlconf

我一直在尝试django教程并坚持这个错误。我在教程的第3页,一切都很顺利,直到我遇到此错误Django Tutorial。我正在按照教程中的确切步骤操作。这是我得到的错误

ImproperlyConfigured at /polls
The included urlconf <module 'polls.urls' from 'C:\\Python34\\mysite\\polls\\urls.py'> doesn't have any patterns in it

我在这里粘贴我的代码。

ROOT_URLCONF = 'mysite.urls'` in settings.py, 
from django.conf.urls import patterns, url
from polls import views

urlpattern = patterns('',
    url(r'^$',views.index,name='index')
)`

在MYSITE / POLLS / URLS.PY

from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'mysite.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),
    url(r'^polls/', include('polls.urls')),
    url(r'^admin/', include(admin.site.urls)),
) 

INSIDE MYSITE.URLS.PY

很抱歉,如果我错过了我必须提及的任何内容,以获得清晰的图片。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:6)

第一个文件有urlpattern而不是urlpatterns