Django Tutorial2-Create an Application

In the series of Django tutorial, this is the second lecture, in which we will command to create an application and will also understand the file structure of the application.

Please click the below link for Django tutorial1.

So, in the last tutorial, we created a project Folder named “FirstProject”.

Go to that directory

cd FirstProject

Now, In this directory, we type the following command which will create an application

python3 manage.py startapp your_project_name

For your clarification, I pasted ss from my project. Here, the application name is Firstapp.

Let’s discuss files.

  1. admin.py: Django comes with a built-in admin interface.
  2. apps.py: This file helps configure the application. You can include application configuration in this file.
  3. models.py: This file creates a database for the web application.
  4. tests.py: You can write tests here, to check whether the application is working as expected.
  5. views.py: A view function or Python function which takes a request and returns a response is written in this file.
  6. __init__py: This file let the Django/Python to treat the directory as a python package.
  7. migrations: A migration folder stores “migrations” files that will automatically update your database as you modify a model.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store