The following error interferes:

File "/root/pyserver/news/news/urls.py", line 1, in <module> from django.conf.urls import patterns, url, include ImportError: cannot import name patterns 

Not on the server (on localhost) everything works fine.

  • Check which versions of Django are installed locally and on the server. Most likely the fact is that they are different. - Lebedev Ilya

2 answers 2

The official Django documentation has a warning about this.

 Deprecated since version 1.8: urlpatterns should be a plain list of django.conf.urls.url() instances instead. 

Correct your urls accordingly - now they should look like this

 from django.conf.urls import patterns, url urlpatterns = [ url(r'^articles/([0-9]{4})/$', ArticleView.as_view()), ] 

By the way, automatic imports through the line are also deleted. Now we need to explicitly prescribe

 from news.views import year_archive ... url(r'^articles/([0-9]{4})/$', year_archive), 

    Information is not enough, but the output can be made like this: on the server is the old version of Django. The module structure was changed in version 1.4 - https://docs.djangoproject.com/ja/1.9/releases/1.4/#django-conf-urls-defaults . Correspondingly, in versions <1.4, the problem line should look like this:

     from django.conf.urls.defaults import patterns, url, include 
    • At 1.10, patterns were deleted altogether, now there are regular arrays - FeroxTL