Django Blog #5: Creating and Activating an Application

by Alex
Django Blog #5: Creating and Activating an Application
In the manuals for this framework you will come across the words “project” and “application”. In Django, a project is a Django installation with certain settings. An application is a group of models, views, templates, and URLs. An application interacts with the framework to provide various features. It can also be used in other developments. A project can be considered a website which includes applications such as a blog, a guidebook, or a forum which can be used in other projects.

Creating the application

Let’s create a blog application in Django. At the command line from the root directory of the project enter the following:

python startapp blog

This will create a standard structure:


The files in it perform these tasks:

  • – this is where the models to be used in the Django administration site are registered (you don’t have to use it).
  • – this directory includes the blog configuration.
  • migrations – this directory includes application database migrations. Django uses them to save information about model changes and synchronize the database accordingly.
  • – application data models. All Django applications should have a file, but it can remain empty.
  • – here you can add tests for the application.
  • – this is where the application logic is located. Each view receives an HTTP request, processes it, and returns a response.

Application Activation

In order for Django to be able to track the application and be able to create databases for the models, the application needs to be activated. This requires editing the file and adding the blog.apps.BlogConfig item to INSTALLED_APP. It should now look like this:


The BlogConfig class is the configuration of an entire application. Django now knows that it is active and will be able to load its models.

Related Posts