KeyError:django中的'DATABASE_URL'1.4 [英] KeyError: 'DATABASE_URL' in django 1.4

查看:257
本文介绍了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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆