Issue with GSWD Heroku Django manage.py

I worked through the excellent django tutorial online, but I am having a problem with the final heroku deployment.

Here is a django tutorial: http://gettingstartedwithdjango.com/en/lessons/introduction-and-launch/

The problem I have with the last call to hero:

heroku python manage.py syncdb

Here is the error I am getting:

(blog-venv)vagrant@precise64:/vagrant/projects/microblog$ heroku run python manage.py syncdb
Running `python manage.py syncdb` attached to terminal... up, run.2530
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs
    cursor = connection.cursor()
  File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/__init__.py", line 306, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 177, in _cursor
    self.connection = Database.connect(**conn_params)
  File "/app/.heroku/python/lib/python2.7/site-packages/psycopg2/__init__.py", line 178, in connect
    return _connect(dsn, connection_factory=connection_factory, async=async)
psycopg2.OperationalError: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

(blog-venv)vagrant@precise64:/vagrant/projects/microblog$

      

Any thoughts

+3


source to share


2 answers


As far as I know (git intermediate level knowledge) If you forgot to add locals.py to your .gitignore file and commit it, then locals.py file will be saved in the git repository.

You have to remove the file from the git repository as it was included in previous commits.

git rm --cached microblog/settings/local.py

      



Then add microblog / settings / local.py to .gitignore and commit the changes.

As soon as the hero sees the correct DATABASES settings. Then syncdb works fine

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

      

+5


source


Have you added: microblogging / Settings / local.py to your .gitignore file?

If that doesn't work try commenting out the DATABASES = {....} bit in the local.py file and see if it works



https://github.com/kennethlove/gswd-transcripts/blob/master/lesson-01.md

+2


source







All Articles