Django | Python For Web Development by Global Emenwa & IfeanyiChukwu Ejike
Author:Global, Emenwa & IfeanyiChukwu, Ejike
Language: eng
Format: epub
Published: 2022-07-14T00:00:00+00:00
Chapter 4 - Create Your First Database-Driven App And Use The Django Admin
In this chapter, we'll build a basic Message Board application where users can post and read short messages. This will be the first time we use a database. We'll look at Django's powerful built-in admin interface, which lets us change our data in a way that is easy to understand. After adding tests, we'll push our code to GitHub and put the app on Heroku.
Thanks to the powerful Object-Relational Mapper (ORM) in Django, there is built-in support for MySQL, PostgreSQL, Oracle, MariaDB, and SQLite as database backends. As developers, we can write the same Python code in a models.py file, and it will automatically be turned into the correct SQL for each database. Only the DATABASES section of our settings.py file that is inside the django project folder needs to be changed. This really is a great feature!
Django uses SQLite by default for local development because it is a file-based database and, therefore, much easier to use than the other database options, which require a separate server to run in addition to Django.
Initial Setup
At this point in the book, we've already set up a few Django projects, so we can quickly go through the basic commands to start a new one. Here's what we need to do:
Create a folder called message-board to store our code.
Make a new project called django_project and install Django in a virtual environment.
Make a new Django app called posts
update the settings file at django project/settings.py.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
What's Done in Darkness by Kayla Perrin(26519)
Shot Through the Heart: DI Grace Fisher 2 by Isabelle Grey(19005)
The Fifty Shades Trilogy & Grey by E L James(18955)
Shot Through the Heart by Mercy Celeste(18877)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 10 by Isuna Hasekura and Jyuu Ayakura(16979)
Python GUI Applications using PyQt5 : The hands-on guide to build apps with Python by Verdugo Leire(16870)
Peren F. Statistics for Business and Economics...Essential Formulas 3ed 2025 by Unknown(16800)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 03 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16693)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 01 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16319)
The Subtle Art of Not Giving a F*ck by Mark Manson(14253)
The 3rd Cycle of the Betrayed Series Collection: Extremely Controversial Historical Thrillers (Betrayed Series Boxed set) by McCray Carolyn(14069)
Stepbrother Stories 2 - 21 Taboo Story Collection (Brother Sister Stepbrother Stepsister Taboo Pseudo Incest Family Virgin Creampie Pregnant Forced Pregnancy Breeding) by Roxi Harding(13416)
Scorched Earth by Nick Kyme(12710)
Drei Generationen auf dem Jakobsweg by Stein Pia(10919)
Suna by Ziefle Pia(10844)
Scythe by Neal Shusterman(10267)
International Relations from the Global South; Worlds of Difference; First Edition by Arlene B. Tickner & Karen Smith(9473)
Successful Proposal Strategies for Small Businesses: Using Knowledge Management ot Win Govenment, Private Sector, and International Contracts 3rd Edition by Robert Frey(9314)
This is Going to Hurt by Adam Kay(9092)
