将 Django 部署到 Heroku(Psycopg2 错误) [英] Deploying Django to Heroku (Psycopg2 Error)
本文介绍了将 Django 部署到 Heroku(Psycopg2 错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我正在使用 django 遵循 heroku 的入门指南.但是,当我运行此命令时:
So I'm following the getting started guide from heroku with django. However when I run this command:
heroku run python manage.py syncdb
我收到此错误
psycopg2.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432?
我认为这意味着数据库尚未设置...所以我也手动添加了 shared_db 选项:
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?
推荐答案
我的应用程序结构已关闭... heroku 希望结构如下所示:
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屋!
查看全文