A clean, modular Django project structure with environment and Docker support.
Project description
๐ค "BrickDjango" โ Meaning in Depth BrickDjango is a metaphorical name that combines:
"Brick" โ the basic building block of construction.
"Django" โ the popular Python web framework you're customizing.
๐งฑ What โBrickโ Suggests: Modularity: Bricks are independent units that come together to form larger structures. Similarly, your Django structure has modular apps, separated settings, and organized layout.
Foundation & Scalability: Bricks form the foundation of a strong, scalable structure. Your custom project structure aims to do the same for Django projects.
Simplicity with Power: Bricks are simple, but powerful when arranged well โ just like your approach to Django project architecture.
๐ BrickDjango User Guide
Table of Contents
-
Installation
-
Features
-
Getting Started
-
Creating a New Project
-
Creating New Apps
-
Project Structure Overview
-
Configuring Settings
-
Best Practices
-
Troubleshooting
๐ฐ Introduction
BrickDjango is a custom Django project scaffolding tool that helps developers start Django projects and apps with a modular, scalable, and maintainable folder structure.
This guide walks you through installing, using, and extending BrickDjango.
๐ฆ Installation
Requirements:
- Python 3.10+
pip(Python package manager)- Virtual environment setup
Steps:
- Clone or install BrickDjango:
bash pip install brickdjango
- Create and activate a virtual environment:
bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
โ๏ธ Features
- Modular project layout (
apps/,config/,base/) - CLI for structured app/project creation
- Automatic app namespacing (
apps.myapp) - Environment-based settings (dev/prod)
- Follows Django best practices with added organization
๐ Getting Started
Use the brickdjango CLI to bootstrap your projects and apps easily.
๐๏ธ Creating a New Project
bash brickdjango startproject
โ This command sets up a new Django project with the custom BrickDjango folder layout.
Example:
bash brickdjango startproject mysite cd mysite
๐งฑ Creating a New App
bash brickdjango startapp
โ
This creates a Django app inside the apps/ directory with proper namespace.
Example:
bash brickdjango startapp blog
๐ This will create: apps/blog/ and modify apps.py like this:
python from django.apps import AppConfig
class BlogConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'apps.blog'
Add the app to INSTALLED_APPS in config/settings/base.py:
python INSTALLED_APPS = [ # ... 'apps.blog', ]
๐๏ธ Project Structure Overview
plaintext
Master/ โโโ base/ โ โโโ utils/ โ โโโ utils.py โโโ apps/ โ โโโ init.py โ โโโ blog/ โ โ โโโ admin.py โ โ โโโ apps.py โ โ โโโ models.py โ โ โโโ views.py โ โ โโโ tests.py โ โ โโโ migrations/ โโโ config/ โ โโโ settings/ โ โ โโโ base.py โ โ โโโ development.py โ โ โโโ production.py โ โ โโโ .env โ โโโ urls.py โ โโโ asgi.py โ โโโ wsgi.py โโโ manage.py โโโ requirements.txt โโโ README.md โโโ venv/
โ๏ธ Settings Management
BrickDjango separates settings by environment:
base.py: Common settingsdevelopment.py: For local devproduction.py: For deployment
You can load them using an environment variable in manage.py or wsgi.py:
python os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.development')
๐ ๏ธ Best Practices
- Always create apps via
brickdjango startapp - Keep all business logic apps in
apps/ - Share reusable code via
base/utils/ - Commit a
.env.examplefor environment variables - Use separate settings for dev and prod
๐งฐ Troubleshooting
๐ธ Error: "Destination directory does not exist"
Make sure apps/ exists:
bash mkdir -p apps brickdjango startapp blog
๐ธ Error: "App already exists"
Choose another app name or remove the existing folder.
BrickDjango gives you a strong foundation to build scalable, maintainable Django applications with ease. Whether you're prototyping or building for production, its modular architecture keeps your code clean and your workflow efficient.
We hope BrickDjango helps you build amazing things โ one brick at a time. ๐งฑโจ
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file brickdjango-0.1.1.tar.gz.
File metadata
- Download URL: brickdjango-0.1.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
882fec100d4f8da4fe3c6b7d547ff2f837d4de8e0921d8c99891e051a51cf21b
|
|
| MD5 |
d7b5a63da714bdb03ccae7cf4ae75304
|
|
| BLAKE2b-256 |
a2b5dbcc483e515859b1b8e9c776943678d73d94d58608071bc682a94464e631
|
File details
Details for the file brickdjango-0.1.1-py3-none-any.whl.
File metadata
- Download URL: brickdjango-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fde5aaf7a27d8fc239c12416133c8d894b97b20c0ec46c00d70cc086a51b02d7
|
|
| MD5 |
d16113e9e72ab1c3b74d1ea2b5f7e9e6
|
|
| BLAKE2b-256 |
dc9ad3adc3d0781461e6957a5cf207ef2af60af49328c931fee445816c38bc92
|