Skip to main content

How to configure Multiple databases in Django


  • The first step to using more than one database with Django is to tell Django about the database servers you’ll be using. 
  • This is done using the DATABASES setting. This setting maps database aliases, which are a way to refer to a specific database throughout Django, to a dictionary of settings for that specific connection. The settings in the inner dictionaries are described fully in the DATABASES documentation.
  • You will find the complete documentation here The first step to using more than one database with Django is to tell Django about the database servers you’ll be using. This is done using the DATABASES setting. This setting maps database aliases, which are a way to refer to a specific database throughout Django, to a dictionary of settings for that specific connection. The settings in the inner dictionaries are described fully in the DATABASES documentation.Databases can have any alias you choose. However, the alias default has special significance. Django uses the database with the alias of default when no other database has been selected.The following is an example settings.py snippet defining two databases – a default PostgreSQL database and a MySQL database called users
  • https://docs.djangoproject.com/en/2.1/topics/db/multi-db/#defining-your-databases
  • complete source code here
  • https://github.com/GanapathiAmbore/Django-with-Multiple-databases

Comments

Popular posts from this blog

Webscrapping using Python for Machine learning,Data Science

In this tutorial we are going to learn and discuss about how to perform web scrapping  using python Web scrapping:                  Web Scraping    is a technique employed to extract large amounts of data from websites whereby the data is extracted and saved to a local file in your computer or to aws s3 services in json format For web scrapping we will use the following libraries they are  Beautiful soup urllib Json for file storing you will find the complete source code here https://github.com/GanapathiAmbore/Webscrapping-using-python