bhylu.com

Advertisements

Django Projects and Apps

The project holds site-wide configuration; an app owns a coherent feature. Our workshop_site package connects the workshops app to the rest of the server.

How it works

manage.py loads the project settings before running management commands. INSTALLED_APPS registers application configuration, and the root URL configuration includes an app’s routes. A project may contain several apps, but creating an app does not automatically register or route it. Start with one useful boundary rather than splitting every model or view into a separate package. The supplied project is complete so each lesson can run independently.

Run in the supplied local Django project

This lesson uses Django 5.2.18 LTS with Python 3.12. Download the source downloader and run node download-project.mjs http://127.0.0.1:8000 with Node 22 while previewing locally. It creates a new bhylu-django-lab folder and refuses to overwrite an existing one. After deployment, the default base is bhylu.com; until then use your local preview URL.

Inside that new folder, create a virtual environment, install requirements.txt and run the complete lesson file shown below. Every lesson creates a fresh in-memory SQLite database and temporary upload storage. It does not edit the interactive lab’s db.sqlite3 or Bhylu’s database. The visible listing below is the lesson’s core code; its complete downloaded file includes the shared bootstrap.

Django does not run in Bhylu’s current browser playground. No Apache, MySQL or global PHP configuration change is needed. See the setup lesson for the full project and commands.

Example

Run .venv\Scripts\python.exe lessons\project-app.py from the downloaded project root. Download the complete lesson file; keep it under lessons/. The project’s shared models, forms, views and fixture are prerequisites, not a hidden online runtime.

lessons/project-app.py — core code

from django.apps import apps
from django.conf import settings
print(apps.get_app_config("workshops").name)
print(settings.ROOT_URLCONF)
print(Workshop._meta.app_label)

Expected result

workshops
workshop_site.urls
workshops

The registered app label connects model metadata, migration names and admin URLs. The project URL module remains a separate package. Inspect both files in the source list to see the include relationship rather than assuming filenames have special routing power.

Use Django’s versioned official documentation for exact API contracts and the deployment checklist before a separate release.

Advertisements