DEV Community

Buono
Buono

Posted on

The Role of Files Output by Default in Django

When creating an application using Django, executing the following command generates the following files. These files are common and essential for efficiently building any application.

# Command
django-admin startproject XXXproject
Enter fullscreen mode Exit fullscreen mode
# Output files
% tree
XXXproject
├── XXXproject
│   ├── __init__.py
│   ├── asgi.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
└── manage.py
Enter fullscreen mode Exit fullscreen mode

I briefly noted the roles of each file. I plan to add, modify, and enhance the completeness as my understanding progresses.

init.py

This file indicates that the directory is a package. It is okay for the file to be empty; it just needs to exist to be recognized as a package.

asgi.py

A file for specifying processing when performing asynchronous operations. "asgi" stands for Asynchronous Server Gateway Interface. Ignore this file initially; it is used when seeking better performance.

settings.py

A file for specifying project-wide settings.

urls.py

A file for switching views based on requests received from the browser. It is similar to the routes file in other frameworks.

wsgi.py

A file containing settings to connect the web server and web application. It acts as an intermediary between the web server and Django.

manage.py

A file for configuring Django's convenient features.

Top comments (0)