Welcome to the Blog Tutorial series of Python Django Tutorial for Beginners. Previously we have covered all basic ideas of creating a new Django project, installing necessary modules which we will be working on, creating a superuser and little bit on database migration.
We also distinguished what a Django Project and Django App is. It’s recommended to go through the blogs from the beginning, if you are looking to Learn Django Application from beginning.
Creating a New Django Application
A Django application is created within a Django Project. We have covered the creation of Django application on our previous blog. Go check it out for a detailed explanation. In order to create a new application we can do it by manage.py startapp command like shown below:
python manage.py startapp applicationaname
Enter your desired application name. With this under your Django Project folder, you can see a folder created for the new app you just created.
Drillthrough of the New Application Directory
Your overall project structure till this phase is something similar to this:
VirtualEnvironmentDirectory bin etc include lib share src DjangoProjectFolder __init__.py settings.py urls.py wsgi.py DjangoAppFolder migrations __init__.py admin.py apps.py models.py tests.py views.py db.sqlite3 manage.py .gitignore requirements.txt
- All Folders are highlighted
- Five folders under the VirtualEnvironmentDirectory are created while we created a new Virtual Environment. (Activate Python Virtualenv / Virtual Environment in Linux? )
- Folder src is a custom folder which we created separate all software codes under src folder. Just to make the project structure look cleaner.
- DjangoProjectFolder is created while we created a new Django AProject with the help of Django Admin ( Install Django Framework, HelloWorld Django! )
- All our further instruction are installed using python manage.py command, which lies under DjangoProjectFolder
- DjangoAppFolder is newly created folder for our new Django App we recently created.
Drillthrough of DjangoAppFolder
DjangoAppFolder is actually your new app name which you recently created. Within this folder you find following file and folders:
- Directory migration: which sill store all our database scheme changes we will make in our application.
- models.py sotres our database model for entire database.
- views.py is where we write code to render the views. HTML scripts can either be directly written in the views page or a different template can be included.
We will be further discussing on the components of our Application folder while implementing the views.