将django部署到heroku

时间:2013-02-14 00:18:14

标签: python django deployment heroku

嗨伙计,所以我跟着guid在heroku上部署django

https://devcenter.heroku.com/articles/django

但我的服务器一直在使用此错误崩溃任何想法或方向非常感谢。

2013-02-12T19:27:40+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-  packages/django/utils/importlib.py", line 35, in import_module
2013-02-12T19:27:40+00:00 app[web.1]:     __import__(name)
2013-02-12T19:27:40+00:00 app[web.1]:   File "/app/eduudle/settings.py", line 15, in   <module>
2013-02-12T19:27:40+00:00 app[web.1]:     DATABASES = { 'default': {dj_database_url.config()}}
2013-02-12T19:27:40+00:00 app[web.1]: TypeError: unhashable type: 'dict'
2013-02-12T19:27:41+00:00 heroku[web.1]: Process exited with status 1
2013-02-12T19:27:41+00:00 heroku[web.1]: State changed from starting to crashed

2 个答案:

答案 0 :(得分:2)

数据库的docs建议格式应为

DATABASES['default'] = dj_database_url.config()

不是

DATABASES['default'] = {dj_database_url.config()}

答案 1 :(得分:1)

发现该文档已过时的问题,因此根据此基础

进行了操作

https://github.com/heroku/heroku-buildpack-python/issues/45

我原本应该使用的但是我添加了太多大括号

所以而不是

 DATABASES = { 'default': {dj_database_url.config()}}

使用

 DATABASES = { 'default': dj_database_url.config()}