问题描述:

I'm a new user of django and i have some difficulties.

I follow a Django 1.8 tutorial and i have Django1.11. the problem is about urls.py files & patterns

Here my code, blog/urls.py:

from django.conf.urls import url

from . import views

urlpattern = [

url(r'^accueil/$', views.home, name='home'),

]

first/urls.py:

from django.conf.urls import url include

urlpattern = [

url(r'^blog/', include('blog/urls')),

]

And when i use runserver command, it display :

URLconf '<module 'blog.urls'>'does not appear to have any patterns in it

I read somewhere that patterns are removed since 1.10 and it's an old syntax now but i don't found the solution.

Any idea ?

网友答案:

Django 1.11 is not released. You should use the actual released version, 1.10. Also, you should use the actual tutorial for your version.

However, the problem is that both of your files should define urlpatterns with an s, not urlpattern.

网友答案:

I think your need this page.URL dispatcher

Your code is fault, I think your need to change it:

from django.conf.urls import url
from . import views

urlpatterns = [
   url(r'^accueil/$', views.home, name='home'),
]
相关阅读:
Top