0
KeyError:'SECRET_KEY'django migrate?
File "/home/user/env/local/lib/python2.7/site-packages/django/conf/__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "/home/user/env/local/lib/python2.7/site-packages/django/conf/__init__.py", line 99, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/user/instagram_miner/ig_miner/settings.py", line 23, in <module>
SECRET_KEY = os.environ['SECRET_KEY']
File "/home/user/env/lib/python2.7/UserDict.py", line 23, in __getitem__
raise KeyError(key)
KeyError: 'SECRET_KEY'
我把一個密鑰,但出現此錯誤
KeyError異常: 'SECRET_KEY'
這是我secrets.sh
出口SECRET_KEY ='鍵碼'
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ['SECRET_KEY']
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
出口SECRET_KEY = mysecretkey
請幫我
請添加更多信息。這是在成功遷移之後發生的嗎?當你嘗試運行你的應用時,發佈你的'settings.py'和服務器的輸出。 PS:小心明智的數據,並從這個線程刪除您的SECRET_KEY – pazitos10
我把更多的信息 – user7412219
我解決這個問題的東西惠特http://stackoverflow.com/questions/37302869/i-added-a-secret-key-config-變量我的django應用程序在Heroku,但現在它不會但不能解決所有問題 – user7412219