【发布时间】:2017-06-04 21:14:34
【问题描述】:
当然,我搜索了一些帖子,但没有一个有帮助。即使是最接近的也无济于事。
我目前正在使用 pyCharm 使用虚拟环境安装 django。
因为我尝试了很多方法,但没有运气使用 pycharm 运行项目
但是,如果我在终端中使用python manage.py runserver 执行此操作,则服务器运行正常。在所有设置之后不知何故在 pyCharm 中,它只是不让我运行。我在pycharm中哪里设置错了?
不管怎样,我收到了这个错误
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
我的 manage.py,因为一些帖子正在谈论这个,但我看到它设置正确
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CodingEntrepreneurs.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise 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?"
)
raise
execute_from_command_line(sys.argv)
我的 settings.py(不用多说,我确实有 KEY)
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'SECRET_KEYSECRET_KEYSECRET_KEYSECRET_KEYSECRET_KEY'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
`
我的文件夹结构
我的运行调试配置
我的 django 框架设置
【问题讨论】:
标签: python django pycharm settings