This repository provides a pre-configured Django project layout designed for rapid development and production-ready setups. It includes a well-organized directory structure, essential configurations, and useful tools to kickstart your Django projects.
- Pre-configured Settings: Separate settings for development and production environments ✨.
- Error Pages: Custom 404, 500, and 502 error pages with interactive animations 🎬.
- Database Routing: Built-in support for multiple databases with a custom router 🗄️.
- Jazzmin Admin: A modern and customizable admin interface 🎨.
- Static and Media Files: Pre-configured static and media file handling 📂.
- Poetry Integration: Manage dependencies and virtual environments with Poetry 📦.
- Interactive Error Pages: Custom error pages with animations for 404, 500, and 502 errors 🌀.
- Multi-Database Support: Built-in support for multiple databases with a custom router 🔗.
- Python 3.10 or higher 🐍
- Poetry (for dependency management) 📦
-
Install Poetry (if not already installed):
pip install poetry
-
Create a New Django Project Using This Layout:
django-admin startproject \ --template=https://github.com/qiyascc/django-layout/zipball/main \ --extension=py,md,toml,json,gitignore \ --name=Makefile,Dockerfile \ YOUR_PROJECT_NAME
-
Navigate to Your Project Directory:
cd YOUR_PROJECT_NAME -
Activate the Virtual Environment:
poetry shell
-
Install Dependencies:
poetry install
-
Run Migrations:
python manage.py migrate
-
Start the Development Server:
python manage.py runserver
django-layout/
├── README.md
├── LICENSE
├── Makefile
├── manage.py
├── pyproject.toml
├── client/
│ └── description.txt
├── databases/
│ └── core/
│ └── description.txt
└── project_name/
├── __init__.py
├── asgi.py
├── config.py
├── routers.py
├── urls.py
├── wsgi.py
├── apps/
│ └── __init__.py
├── settings/
│ ├── __init__.py
│ ├── base.py
│ ├── dev.py
│ └── prod.py
├── static/
│ ├── error/
│ │ ├── script.js
│ │ └── styles.css
│ └── logo/
└── templates/
├── 404.html
├── 500.html
├── 502.html
└── error/
└── base.html
DJANGO_SECRET_KEY: Set your secret key for Django 🔑.DJANGO_SETTINGS_MODULE: Automatically set toproject_name.settings.devorproject_name.settings.prodbased on thedebugflag in the configuration.
- Development Settings: Located in
project_name/settings/dev.py. - Production Settings: Located in
project_name/settings/prod.py.
You can add custom configurations in project_name/config.py. This file uses goodconf for managing settings with environment variables 🌐.
To run the project in development mode, ensure the debug flag is set to True in the configuration. The development server can be started with:
python manage.py runserverFor production, set the debug flag to False and configure the necessary production settings in project_name/settings/prod.py. You can use gunicorn to serve the application:
gunicorn project_name.wsgi:applicationCustom error pages are provided for 404, 500, and 502 errors. These pages include interactive animations and can be customized in the templates/ directory.
Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests. 🐛✨
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for more details.
- Telegram 📱