0

I have a django based herokuapp site. I set everything up a long time ago and am now unable to get things working with a local instance of postgresql. In my settings file, I updated:

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

to work with a local database:

DATABASES['default'] = dj_database_url.config(default='postgres://localhost/appDB')

When running foreman, I can view the site, but the database is not currently populated (although I did create the empty DB). Running:

heroku run python manage.py dumpdata

Returns the contents of the remote (herokuapp) database, while a syncdb command results in "Installed 0 object(s) from 0 fixture(s)". So it looks like I'm still contacting the remote database. I'm pretty sure the postgresql DB is setup correctly locally; how can I force the app to use it?

I'm sure this is simple, but I haven't seen anything useful yet. I did try

export DATABASE_URL=postgres:///appDB

but that hasn't helped.

Cheers

5
  • you want to use you local DB in heroku?
    – rogelio
    Oct 5, 2014 at 22:57
  • To test and develop the Django app locally
    – radpotato
    Oct 6, 2014 at 7:50
  • It's not clear to me that I should be running the heroku commands rather than the same django commands without the heroku interface, however, when I do this (inside a virtualenv) e.g. python manage.py syncdb, I get import errors on the django modules.
    – radpotato
    Oct 6, 2014 at 7:57
  • Oh, now I feel stupid! Turns out I just needed the edits mentioned above to the settings file and then run the regular django commands outside of the virtual env.
    – radpotato
    Oct 6, 2014 at 8:01
  • Well, if you need to test locally your database, isn't necessary to run heroku commands.
    – rogelio
    Oct 6, 2014 at 22:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.