在创建模型后,我刚刚开始使用django。我创建了一个项目调查。用于数据库迁移。
python manage.py makemigrations polls
它抛出错误: -
ImportError: Could not import settings 'mysite.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named mysite.settings
以下是manage.py的外观: -
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
以下是目录结构的外观: -
.
|-- db.sqlite3
|-- __init__.py
|-- __init__.pyc
|-- manage.py
|-- polls
| |-- admin.py
| |-- admin.pyc
| |-- __init__.py
| |-- __init__.pyc
| |-- migrations
| | `-- __init__.py
| |-- models.py
| |-- models.pyc
| |-- tests.py
| |-- tests.pyc
| |-- views.py
| `-- views.pyc
|-- settings.py
|-- settings.pyc
|-- urls.py
|-- urls.pyc
|-- wsgi.py
`-- wsgi.pyc