将Django部署到Heroku(Psycopg2错误) [英] Deploying Django to Heroku (Psycopg2 Error)

查看:183
本文介绍了将Django部署到Heroku(Psycopg2错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在跟着从django的heroku入门指南。但是,当我运行这个命令:

  heroku运行python manage.py syncdb 
/ pre>

我收到这个错误

  psycopg2.OperationalError:可以不连接到服务器:连接拒绝
服务器是否在主机localhost上运行,并接受
端口5432上的TCP / IP连接?

我认为这意味着db尚未设置...所以我手动添加shared_db选项:

  heroku addons:add shared-database:5mb 
/ pre>

但是,我仍然得到相同的错误。什么给了?

解决方案

我的应用程序结构已关闭... heroku希望结构如下所示:

  toplevel 
requirements.txt
myapp
manage.py
所有其他django东西


So I'm following the getting started guide from heroku with django. However when I run this command:

heroku run python manage.py syncdb

I get this error

psycopg2.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432?

I assumed this meant that the db wasn't set up yet... so I manually added the shared_db option as well:

heroku addons:add shared-database:5mb

But.. I still get the same error. What gives?

解决方案

My app structure was off... heroku wants the structure to look like this:

toplevel
  requirements.txt
  myapp
    manage.py
    all other django stuff

这篇关于将Django部署到Heroku(Psycopg2错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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