django学习笔记:
1,
执行:python manage.py makemigrations
报错信息
File "D:\lele\test_dev\test_platform\project_app\urls.py", line 3, in <module>
from project_app import views
File "D:\lele\test_dev\test_platform\project_app\views.py", line 3, in <module>
from project_app.models import Project
File "D:\lele\test_dev\test_platform\project_app\models.py", line 9, in <module>
class Project(models.Model):
File "D:\Program Files (x86)\Python37-32\lib\site-packages\django\db\models\base.py", line 95, in new
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class project_app.models.Project doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
解决方法:
在settings里面添加上这句话:
'project_app.apps.ProjectAppConfig',
再执行:python manage.py makemigrations
运行正常
2,
页面登录进入http://127.0.0.1:8000/login_action/manage/project_manage/
按计划是进入/manage/project_manage/这个网址
后面修改views里的代码:
return HttpResponseRedirect('manage/project_manage/')
改为:
return HttpResponseRedirect('/manage/project_manage/')
再登录就好了。
3,
这里写错了,调整后,访问登录页面还报错,
图片.png
应对:重新启动服务就可以了。
4,
{% if type == "add" %}
原来的错误的地方是 {% if type =="add" %}
网友评论