Django Settings
Settings are Python configuration loaded for a process. Make development defaults explicit and require real secrets when preparing a non-debug environment.
How it works
The supplied lab uses SQLite and a clearly labelled local-only key in debug mode. Its production settings require environment values and turn off debug. ALLOWED_HOSTS checks accepted host names; it is not a list of browser clients or a replacement for authentication. Keep secrets outside the repository and validate configuration at startup. A working development default is not evidence that a service is ready for public traffic.
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\settings.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.
from django.conf import settings
print(settings.DEBUG)
print(settings.DATABASES["default"]["ENGINE"].rsplit(".", 1)[-1])
print("127.0.0.1" in settings.ALLOWED_HOSTS)
Expected result
True sqlite3 True
Each standalone lesson deliberately starts with a fresh in-memory SQLite database. The interactive manage.py server instead uses the lab’s own db.sqlite3 file. Neither setup reads or changes the Laravel database.
Use Django’s versioned official documentation for exact API contracts and the deployment checklist before a separate release.