本文介绍了KeyError:django中的'DATABASE_URL'1.4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Django 1.4.3的项目,并尝试在我的Mac上设置。但是引发错误 KeyError:'DATABASE_URL'
settings.py:
DATABASES = {'default':dj_database_url.config()}
DATABASE_URL = os.environ ['DATABASE_URL']
数据库的环境配置:
os.environ ['DATABASE_URL'] ='postgres:// postgres:password @ localhost:5432 / viggo_backend'
解决方案
在终端我必须做
export DATABASE_URL = postgres:// postgres:password @ localhost:5432 / viggo_backend
/ pre>
I have a project on Django 1.4.3 and try to set up on my mac. But raise an error
KeyError: 'DATABASE_URL'
settings.py:
DATABASES = {'default': dj_database_url.config()} DATABASE_URL = os.environ['DATABASE_URL']
environ config for database:
os.environ['DATABASE_URL'] = 'postgres://postgres:password@localhost:5432/viggo_backend'
解决方案In terminal i have to do
export DATABASE_URL=postgres://postgres:password@localhost:5432/viggo_backend
这篇关于KeyError:django中的'DATABASE_URL'1.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!