2012-08-15 82 views
3

我正在設置一個新的開發環境,遵循django安裝教程並遇到問題。這是當我嘗試運行syncdb時得到的結果Heroku postgres連接:「服務器是否在本地運行並接受在Unix域套接字上的連接」

Running `python doccal/manage.py syncdb` attached to terminal... up, run.1 
Traceback (most recent call last): 
    File "doccal/manage.py", line 14, in <module> 
    execute_manager(settings) 
    File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__i 
nit__.py", line 459, in execute_manager 
    utility.execute() 
    File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__i 
nit__.py", line 382, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/bas 
e.py", line 196, in run_from_argv 
    self.execute(*args, **options.__dict__) 
    File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/bas 
e.py", line 232, in execute 
    output = self.handle(*args, **options) 
    File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/bas 
e.py", line 371, in handle 
    return self.handle_noargs(**options) 
    File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/com 
mands/syncdb.py", line 57, in handle_noargs 
    cursor = connection.cursor() 
    File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/backends/__init_ 
_.py", line 306, in cursor 
    cursor = self.make_debug_cursor(self._cursor()) 
    File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/backends/postgre 
sql_psycopg2/base.py", line 177, in _cursor 
    self.connection = Database.connect(**conn_params) 
    File "/app/.heroku/venv/lib/python2.7/site-packages/psycopg2/__init__.py", lin 
e 179, in connect 
    connection_factory=connection_factory, async=async) 
psycopg2.OperationalError: could not connect to server: No such file or director 
y 
     Is the server running locally and accepting 
     connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? 

我在使用相同步驟之前設置了相同的項目並從未遇到過問題。幾周前,我做了一封Heroku正在從共享數據庫遷移出來的電子郵件,並假設這涉及到某種程度的問題。

另外,我也注意到在本教程中,即兩個新的步驟,安裝DJ-數據庫URL和增加這些線路的settings.py

import dj_database_url 
DATABASES = {'default': dj_database_url.config(default='postgres://localhost')} 

我試圖使用和不使用這些運行此不管怎樣,都會遇到相同的問題。

另一篇文章建議的修正是爲了做到這一點

heroku addons:add shared-database 

試過,獲取共享數據庫已被棄用,使用Heroku的,PostgreSQL的消息,但沒有任何效果。

感謝所有幫助

+0

我有確切的問題。 – frbry 2012-10-30 19:38:12

回答

0

配置主機爲localhost,如:

'HOST': 'localhost', 
相關問題