为什么它显示错误来自。视图无法导入

时间:2018-03-08 19:55:29

标签: django

音乐/ urls.py

from django.conf.urls import url
from . import views

urlpatterns = [

    url(r'^$', views.index, name='index'),

    url(r'^(?P<album_id>[0-9)+$', views.detail, name='detail'),

]

后跟views.py代码

from django.http import HttpResponse
def index(request):
    return HttpResponse("<h1>this is something</h1>")

def detail(request, album_id):
    return HttpResponse("<h2> details of album " + str(album_id)+"</h2>")

主网址网站构建正确..

0 个答案:

没有答案