好友
阅读权限10
听众
最后登录1970-1-1
|
1.AttributeError: module 'html.parser' has no attribute 'HTMLParseError'
python和django的版本是多少?你应该是用了不兼容的python和django的组合,一般发生在使用python3.3以上和django1.8以下的组合
pip uninstall django
pip install django
from django.conf.urls import include, url
from django.contrib import admin
from app01 import views
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^$',views.index_page),
url(r'^page(\d+)$',views.pagen_view),
]
from django.shortcuts import HttpResponse
def index_page(request):
html = " <h1>index_page</h1> "
return HttpResponse(html)
def pagen_view(request,n):
html = f" <h1>第{n}个页面</h1> "
return HttpResponse(html)
url(r'^person/(?P<name>\w+)/(?P<age>\d{1,2})',views.person_view), 关键字传参
def person_view(request,**kwargs):
s = str(kwargs)
return HttpResponse(s)
|
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|