摘要:
django.contrib.auth from django.contrib import auth def login_action(request): if request.method == 'POST': username = request.POST.get('username','') 阅读全文
摘要:
postman 接口测试工具 阅读全文
摘要:
POST 请求导致CSRF漏洞 解决方案: 1.忽略该检查 2.使用模板标签添加CSRF令牌,在form表单加入{% csrf_token %} 阅读全文
摘要:
def login_action(request): if request.method == 'POST': username = request.POST.get('username','') password = request.POST.get('password','') user = a 阅读全文
摘要:
问题:第一次迁移数据库时没有成功创建limit,status,email,sign字段,没有填写如图一 四个箭头指向的括号及内容 导致 迁移数据库时,以上四个字段没有创建成功! 解决方案:增加如图一 四个箭头指向的内容,重新迁移,执行以下两个命令,执行成功看结果图 python manage.py 阅读全文
摘要:
解决方案: settings.py DEBUG 设置为True 阅读全文
摘要:
# SECURITY WARNING: don't run with debug turned on in production!# ALLOWED_HOSTS是为了限定请求中的host值,一般不建议使用*通配符配置,当DEBUG为False时必须配置,否则会抛出异常# 学习使用,因此没有网址,所以 阅读全文
摘要:
1.配置urls.py from django.contrib import adminfrom django.urls import path,re_pathfrom sign import views urlpatterns = [ path('admin/', admin.site.urls) 阅读全文
摘要:
1.安装django pip install django 2.创建项目 django-admin startproject guest 3.创建应用 在guest项目下创建:python manage.py startapp sign 一个项目支持多个应用,添加新的应用需要在配置文件(guest/ 阅读全文
摘要:
1.unittest 浏览器的启动或关闭,只能基于测试方法或测试类; pytest可以通过conftest.py文件配置全局浏览器的启动或关闭 2.测试用例失败截图,pytest-html可以实现测试用例运行失败自动截图,只需要在conftest.py配置即可' unittest不支持!!! 3.测 阅读全文