【报错1】
【报错】
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
raise ImportError(
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
【解决】
source venv/bin/activate
【报错2】
【报错】
ImportError: cannot import name 'AliPayConfig' from 'alipay' (/Users/biubiubiu/Desktop/XX/XXX/djangomg217/venv/lib/python3.8/site-packages/alipay/__init__.py)
【解决】
pip3 install python-alipay-sdk --upgrade #网络原因可能第一次会失败~多试试
【报错3】
【报错】
File "/Users/biubiubiu/PycharmProjects/去哪儿旅游/WhereToGo/WhereToGo/settings.py", line 61, in <module>
"DIRS": [BASE_DIR / 'templates'], #目录
TypeError: unsupported operand type(s) for /: 'str' and 'str'
【解决】
1、点击链接定位到错误位置
2、修改如下图
before: # "DIRS": [BASE_DIR / 'templates'], #目录
After: "DIRS": [os.path.join(BASE_DIR,'templates')],