📝 Django

Django Project Structure

P
Author
Pyland
📅
Published
30.06.2026
⏱️
Reading time
1 min
👁️
Views
79
🌱
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

📝

pytest-django: Testing Django

Охватываемые темы: Installation, @pytest.mark.djangodb, Fixtures, Testing views.

📅 30.06.2026 👁️ 132
📝

Django: Template Tags

Template tags are logic inside HTML. Unlike {{ variable }} which only outputs a value,...

📅 30.06.2026 👁️ 85
📝

Django: Static Files

Static files are CSS, JavaScript, images, and fonts. Django handles them in a specific way:...

📅 30.06.2026 👁️ 73

Did you like the article?

Subscribe to our updates and receive new articles first. Grow with PyLand!