Reputation: 11
I used the Django's version is 1.10.4 and was seeing in my file mysite/urls.py
from django.conf.urls import url,include
from django.contrib import admin
urlpatterns = [
url(r'^admin/',include(admin.site.urls)),
url(r'^website/$',"website.views.first_page"),
]
and views.py in mysite/mysite/
# -*- coding: utf-8 -*-
from django.http import HttpResponse
def first_page(request):
return HttpResponse("<p>hello Django</p>")
Did these settings but I always have the current error.Help me.
Upvotes: 0
Views: 2679
Reputation: 8526
String reference is deprecated in Django 1.10. So, Django 1.10 no longer allows you to specify views as a string in your URL patterns. You can no longer pass import paths to url(), you need to pass the actual view function. The solution is to update your urls.py to include the view callable. This means that you have to import the view in your urls.py.
Use these urls.py instead :
from django.conf.urls import url,include
from django.contrib import admin
from mysite.views import first_page
urlpatterns = [
url(r'^admin/',include(admin.site.urls)),
url(r'^website/$',first_page)
]
Upvotes: 1