Opened 7 years ago

Closed 7 years ago

#27016 closed Bug (invalid) startproject creates that raises ImportError

Reported by: stemaan Owned by: nobody
Component: Core (URLs) Version: 1.10
Severity: Normal Keywords: startproject, ImportError, urls
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


This is the default file created by above command:

from django.conf.urls import patterns, include, url

from django.contrib import admin

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

    url(r'^admin/', include(,

having such a setup, after running a runserver command leads to:

ImportError: cannot import name patterns

According to Feature removed in 1.10

django.conf.urls.patterns() is removed.

Change History (1)

comment:1 Changed 7 years ago by Baptiste Mispelon

Resolution: invalid
Status: newclosed


I think there's an issue with your setup where uses an older version of Django (1.7 by the looks of it) but your project actually uses a more recent (1.10) Django version.

When using Django 1.10, startproject will use correct imports.

Can yo ucheck what --version returns? I'll mark this ticket as invalid for now but please reopen it if it turns out my analysis is incorrect.


Note: See TracTickets for help on using tickets.
Back to Top