Let's install Django, using PIP (official package manager for Python)
Create the project folder
.at the end of the command.
Create the database and the app tables
Start the application
Add a new route - edit
Update the configuration to include the new app -
Update the routing rules as below -
Visualize the default SQL settings -
ENGINEspecify the technology used to manage the database. In our case is a lightweight (yet powerful) SQLite engine.
NAMEinforms Django where to save the database on the filesystem.
Define a new model
sampleapplication. The below changes should be added to
Generate the SQL code (
Apply changes on the database
Use the model via CLI
List all items (books) (using the CLI)
Django Model - add text representation of an object
__str__()method for the
superusershould be created using the Django CLI:
Create Django Superuser
Booksin our case, we need just a few lines of code.
Bookmodel to be visible in the
Booksmodel listed in the admin page:
Django Admin - Edit Book Items