๐Ÿ“ Django

Django Project Structure

P
Author
PyLand Team
๐Ÿ“…
Published
30.06.2026
โฑ๏ธ
Reading time
1 min
๐Ÿ‘๏ธ
Views
286
๐ŸŒฑ
Level
Beginner

After running django-admin startproject mysite, the following standard structure is created:

mysite/
โ”œโ”€โ”€ manage.py          # Command-line utility
โ””โ”€โ”€ mysite/
    โ”œโ”€โ”€ __init__.py
    โ”œโ”€โ”€ settings.py    # Project settings
    โ”œโ”€โ”€ urls.py        # Root URL router
    โ”œโ”€โ”€ wsgi.py        # WSGI server (production)
    โ””โ”€โ”€ asgi.py        # ASGI server (async)

manage.py

The entry point for all Django management commands:

python manage.py runserver      # start the development server
python manage.py migrate        # apply migrations
python manage.py createsuperuser
python manage.py shell

settings.py โ€” Key Settings

# Secret key โ€” never commit this!
SECRET_KEY = 'django-insecure-...'

# Always False in production
DEBUG = True

ALLOWED_HOSTS = []  # ['mysite.com'] in production

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'myapp',  # your application
]

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}

LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'

urls.py โ€” Root Router

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('tasks/', include('tasks.urls')),  # include app URLs
]

Application Structure

python manage.py startapp tasks
tasks/
โ”œโ”€โ”€ __init__.py
โ”œโ”€โ”€ admin.py       # model registration for the Admin site
โ”œโ”€โ”€ apps.py        # app configuration
โ”œโ”€โ”€ models.py      # database models
โ”œโ”€โ”€ views.py       # request handling logic
โ”œโ”€โ”€ urls.py        # app URL routes
โ”œโ”€โ”€ forms.py       # forms (create manually)
โ””โ”€โ”€ templates/     # HTML templates (create manually)
    โ””โ”€โ”€ tasks/

Your reaction to the article

๐Ÿ’ฌ Comments (0)

๐Ÿ” Sign in to leave a comment
๐Ÿšช Login
๐Ÿ’ญ

No comments yet

Be the first to share your opinion about this article!

๐Ÿ”— Similar

Similar articles

Continue learning with these materials

๐Ÿ“

Search in Django

You can start with simple Django ORM filters and move to PostgreSQL features when you...

๐Ÿ“… 30.06.2026 ๐Ÿ‘๏ธ 279
๐Ÿ“

Swagger Documentation with drf-spectacular

drf-spectacular generates an OpenAPI 3.0 schema and Swagger UI for DRF.

๐Ÿ“… 30.06.2026 ๐Ÿ‘๏ธ 561
๐Ÿ“

settings.py: Django Configuration

settings.py is the central configuration file for a Django project.

๐Ÿ“… 30.06.2026 ๐Ÿ‘๏ธ 315
๐ŸŽ“ Continue learning

Courses that cover this material

Visit the course to apply this material in practice.

Django RequestLab: from HTTP to secure production Open course curriculum