Reputation: 6629
Ive setup django and am setting up my urls like
from django.conf.urls import include, url
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^home/$', views.homepage),
]
The above always produces an error
cannot import name views
PROJECT STRUCTURE
geoff
settings.py
urls.py //using this
wsgi.py
homepage
migrations->folder
_init_.py
.....others here
views.py
Upvotes: 1
Views: 1796
Reputation: 379
You have a indent issue in your urls.py.
Check the below line
`from . import views`
You have a extra space at start of this line. Please remove the space your problem will gets solved.
Upvotes: 0
Reputation: 852
You need to change from . import views
to from homepage.views import homepage(mapping function)
Upvotes: 0