Heroku / Django: no module named dj_database_url

Am I trying to configure PostgresSQL for the first time on Django, encountering this error when I try to make a synd?

ImportError: Failed to import settings "testapp.settings" settings (on sys.path?):

You also have this on the topic of my settings.py file, I don’t know if this is correct?

import dj_database_url DATABASES = {'default': dj_database_url.config(default=os.environ.get('DATABASE_URL'))} 
+8
python django postgresql heroku
source share
2 answers

You do not give a lot of information about exactly where you are trying to start synchronization? Locally? Or on Geroku? My answer suggests that it is local.

Basically, you need to have virtualenv install and pip. Working in your virtual virtual (with activated), you need to do

  pip install dj-database-url 

Then you need to do:

  pip freeze > requirements.txt 

Getting started and switching to Python + Django + Heroku is not a very difficult task ... but there are many steps. If you are fuzzy, I recommend the Heroku Django tutorial.

+24
source share

You need to install dj-database-url.

Add it to the requirements.txt file.

+1
source share

All Articles