Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Basics What a View! Running the Server

Raza Haider
Raza Haider
7,611 Points

How to use postgres sql

As shown in the video sqlite 3 is default, Is there a way to make postgres sql default ?

1 Answer

Viktor Panasyuk
Viktor Panasyuk
3,535 Points

You should change settings.py, especially this line - DATABASES = {...}

More here:

Database

https://docs.djangoproject.com/en/2.1/ref/settings/#databases

"When connecting to other database backends, such as MySQL, Oracle, or PostgreSQL, additional connection parameters will be required. See the ENGINE setting below on how to specify other database types. This example is for PostgreSQL:

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'mydatabase', 'USER': 'mydatabaseuser', 'PASSWORD': 'mypassword', 'HOST': '127.0.0.1', 'PORT': '5432', } }"