I\'ve been trying to learn Django for the past few days, but recently I\'ve stumbled upon a problem I can\'t seem to fix. After finishing Django\'s own tutorial on writing y
Either do this :
from lru.views import *
urlpatterns = patterns(
'',
url(r'^$', index, name='index')
)
or
from lru import views
urlpatterns = patterns(
'',
url(r'^$', 'views.index', name='index')
)
I hope this helps.
The second argument of url()
should be string, anway I would change the lru/urls.py
to:
from django.conf.urls import patterns, url
urlpatterns = patterns('',
url(r'^$', 'lru.views.index', name='lru-index')
)
Hope it helps!
Import the urls.py module into your view. like this;
from django.http import HttpResponse
from . import urls
def index(request):
return HttpResponse("Hello, world. You're at the poll index.")