Python and Django Full Stack - Using Django models to communicate with PostgreSQL Database
Django – Using Models to communicate with PostgreSQL Database So far we have learnt to set up our project and its applications, create views and map URL, using simple templates and tags, and serving media files. Now, we will learn about Django models and how to use them to communicate with the postgreSQL database. We will also learn about the Django admin interface. 1.1. Settings to connect to PostgreSQL Django comes with an inbuilt sqllite3 database. In the project's settings.py file, there is a section on DATABASES which by default points to the sqllite3 database. To ask Django to connect to PostgreSQL, change the 'default' DATABASES dictionary in the Django project's settings.py file, like so: DATABASES = { ' default ' : { ' ENGINE ' : ' django.db.backends.postgresql ' , ' NAME ' : ' fooddb ' , ' USER ' : ' xxxxx ' , ' PASSWORD ' : ...