Database Reference
In-Depth Information
Connecting with Django
To connect to PostgreSQL using the Django framework it is necessary to install the
dj-
database-url
package and add it in the dependency file called
require-
ments.txt
.
$ pip install dj-database-url
$ pip freeze > requirements.txt
Then add the following code at the bottom of
settings.py
file:
import dj_database_url
DATABASES['default'] = dj_database_url.config()
In the deploy process, the
DATABASE_URL
variable will be parsed and converted into a
form that Django can understand.