Opened 8 years ago
Closed 8 years ago
#27016 closed Bug (invalid)
django-admin.py startproject creates urls.py 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 |
Description
This is the default urls.py file created by above command:
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'plab_django_admin.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), )
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.
Note:
See TracTickets
for help on using tickets.
Hi,
I think there's an issue with your setup where
django-admin.py
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,
django-admin.py startproject
will use correct imports.Can yo ucheck what
django-admin.py --version
returns? I'll mark this ticket asinvalid
for now but please reopen it if it turns out my analysis is incorrect.Thanks.