Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.2.3创建数据库 执行 ./manage.py makemigrations 报错 #29

Open
Thornstone opened this issue Nov 22, 2019 · 1 comment
Open

5.2.3创建数据库 执行 ./manage.py makemigrations 报错 #29

Thornstone opened this issue Nov 22, 2019 · 1 comment

Comments

@Thornstone
Copy link

django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

.
├── blog
│   ├── admin.py
│   ├── apps.py
│   ├── init.py
│   ├── migrations
│   │   └── init.py
│   ├── models.py
│   ├── tests.py
│   └── views.py
├── comment
│   ├── admin.py
│   ├── apps.py
│   ├── init.py
│   ├── migrations
│   │   └── init.py
│   ├── models.py
│   ├── tests.py
│   └── views.py
├── config
│   ├── admin.py
│   ├── apps.py
│   ├── init.py
│   ├── migrations
│   │   └── init.py
│   ├── models.py
│   ├── tests.py
│   └── views.py
├── db.sqlite3
├── manage.py
└── typeidea
├── init.py
├── pycache
│   ├── init.cpython-36.pyc
│   ├── settings.cpython-36.pyc
│   ├── urls.cpython-36.pyc
│   └── wsgi.cpython-36.pyc
├── settings
│   ├── base.py
│   ├── develop.py
│   ├── init.py
│   └── pycache
│   └── init.cpython-36.pyc
├── urls.py
└── wsgi.py

有生成db.sqlite3

@Keegan-y
Copy link

拆分完 settings 之后,还需要修改两个文件一-manage. py和 typeidea/wsgi. py ,因为 Django
启动时需 知道 settings 件的路 因此, 需要把这两个文件中的这 行代码:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "BBS项目.settings")
改为
profile = os.environ.get("TYPEIEDA_PROFILE","develop")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "typeidea.settings.%s" % profile)
注意:TYPEIEDA_PROFILE和typeidea.settings是你自己创建的应用名。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants