我是Django的初学者,在urls.py中遇到语法错误

时间:2017-07-23 16:32:06

标签: django python-3.x web django-templates django-views

这是我的个人/ urls.py。我一直试图解决这个问题很多天。我知道这肯定是一个非常愚蠢的错误,但我们将不胜感激。

from django.conf.urls import url, include
from . import views
urlpatterns = [
   url(r'^$',views.index, name='index'),
   url(r'contact/',views.contact, name='contact')
   url(r'about/',views.about, name='about')
]

这是views.py

def index(request):
  return render(request, 'personal/home.html')

def contact(request):
  return render(request, 'personal/basic.html', {'content':['https://www.facebook.com/arjunkashyap30']})

def about(request):
  return render(request, 'personal/about.html', {'content': ["This is an abut 
page"]})

1 个答案:

答案 0 :(得分:3)

您在定义的每个端点的末尾忘记了comma

urlpatterns = [
    url(r'^$',views.index, name='index'),
    url(r'contact/',views.contact, name='contact'),
    url(r'about/',views.about, name='about'),
]