In the previous chapter, we briefly explained most parts of the Django basic architecture – urls.py as a URL dispatcher, views.py for providing fundamental logic to handle HTTP requests, and templates for converting views.py's output into HTML format.
models.py and database are the last critical parts of the Django basic architecture. To create a database in Django, models.py plays a critical role in providing database design information.
In Django, there are three steps to create a database.
makemigration
commandmigrate
commandIn addition to these three steps, you may want to modify the admin.py file to reflect a newly created database on the Django admin page.
In the following sections, we'll explain the key steps in detail.
In the previous chapter, we briefly explained most parts of the Django basic architecture – urls.py as a URL dispatcher, views.py for providing fundamental logic to handle HTTP requests, and templates for converting views.py's output into HTML format.
models.py and database are the last critical parts of the Django basic architecture. To create a database in Django, models.py plays a critical role in providing database design information.
In Django, there are three steps to create a database.
makemigration
commandmigrate
commandIn addition to these three steps, you may want to modify the admin.py file to reflect a newly created database on the Django admin page.
In the following sections, we'll explain the key steps in detail.