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'
这是我的秘密密码.sh
导出SECRET_KEY ='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
请帮帮我
答案 0 :(得分:0)
导出SECRET_KEY = mysecretkey ./manage.py runserver
这解决了我的问题谢谢