社区版pycharm创建django项目的一些问题

如题所述

第1个回答  2022-07-16
1. cannot import view

解决:项目名称——右键——设为Sources root

2. cannot find templates

解决:在setting.py里把空的'DIRS’改成

'DIRS': [os.path.join(BASE_DIR,'templates')],

3. page not found

老师课上url路径设置为path(r'^app01/',include('app01.urls')),当只有一个项目时可以运行,然而多项目时报错,此时需要把^都去掉。

4.社区版在tools里找不到run manage.py task

解决:运行项目,会报错,此处错误原因是Django项目版本与mysql驱动版本不匹配的问题,点链接进去把版本的两行注释掉,然后在settings.py里把项目名称加进去,运行python manage.py makemigrations以及python manage.py migrate

5. 社区版连接mysql出现报错:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

解决:

6. 双击表单选择no filter就看到表单内容了。
相似回答