Creating an application

Now, let's create our first Django application. We will create a blog application from scratch. From the project's root directory, run the following command:

python manage.py startapp blog

This will create the basic structure of the application, which looks like this:

blog/    __init__.py    admin.py    apps.py    migrations/        __init__.py    models.py    tests.py    views.py

These files are as follows:

  • admin.py: This is where you register models to include them in the Django administration site—using the Django admin site is optional.
  • apps.py: This includes the main configuration of the blog application.
  • migrations: This directory will contain database migrations of your application. Migrations allow Django to track your model changes ...

Get Django 2 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.