I imported a Django project from a repo, and when I try to make the migrations with python manage.py makemigrations
, I get the following exception:
File "C:\Users\Iván\AppData\Local\Programs\Python\Python36\Lib\site-packages\django\conf\__init__.py", line 161, in __init__
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
After looking online, I read that adding from base import *
to __init__.py
could solve it, but it just sends a different error:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
File "C:\Users\Iván\AppData\Local\Programs\Python\Python36\Lib\site-packages\django\conf\urls\static.py", line 22, in static
raise ImproperlyConfigured("Empty static prefix not permitted")
django.core.exceptions.ImproperlyConfigured: Empty static prefix not permitted
My 'base.py' settings do have SECRET_KEY = 'my_key_value'
, and my 'local.py' settings first line is from.base import *
, and it doesn't override the SECRET_KEY, so I don't know why it says the SECRET_KEY is empty. I do not see any other settings through the project, so I don't know where else to look, I'm new to django, so I'm a bit lost here and have been stuck for a few days.
In my 'wsgi.py' file, as well, it includes the line
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'quiniela.settings')
And in 'quiniela.settings' I have the 'init.py', 'base.py' and 'local.py'
我通过在我的 manage.py 文件os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'quiniela.settings.local')
更改为os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'quiniela.settings')
来修复它,但仅在那里,不在 wsgi.py 中或更改任何其他内容。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.