简体   繁体   中英

Django1.11 - URLconf does not appear to have any patterns

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'),
]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM