2017-01-26 7 views
0

KeyError: 'SECRET_KEY' Django migrieren?

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'

ich einen geheimen Schlüssel setzen, aber erscheint diese Fehler

KeyError: 'secret_key'

dies ist mein Code von secrets.sh

Export secret_key = 'Taste '

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 = []

Export secret_key = MySecretKey

bitte helfen Sie mir

+0

Bitte weitere Informationen hinzufügen . Dies geschah nach einer erfolgreichen Migration oder währenddessen? Veröffentlichen Sie Ihre 'settings.py' und die Ausgabe des Servers, wenn Sie versuchen, Ihre App auszuführen. PS: sei vorsichtig mit vernünftigen Daten und entferne dein SECRET_KEY von diesem Thread. – pazitos10

+0

ich habe mehr Informationen eingefügt – user7412219

+0

ich löse etwas mit dieser Frage http://StackOverflow.com/Questions/37302869/i-added-a-secret-key-config- Variable-zu-meinem-Django-App-auf-Heroku-aber-jetzt-es-wont, aber nicht lösen alle Probleme – user7412219

Antwort

0

Export secret_key = MySecretKey ./manage.py runserver

diese meine Frage dank lösen

Verwandte Themen