Skip to main content

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

  1. Installation

  2. Features

  3. Getting Started

  4. Creating a New Project

  5. Creating New Apps

  6. Project Structure Overview

  7. Configuring Settings

  8. Best Practices

  9. 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:

  1. Clone or install BrickDjango:

bash pip install brickdjango

  1. 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


    
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 settings
  • development.py: For local dev
  • production.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.example for 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brickdjango-0.1.3.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brickdjango-0.1.3-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file brickdjango-0.1.3.tar.gz.

File metadata

  • Download URL: brickdjango-0.1.3.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for brickdjango-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f1e1dc57f0ad1b3e2a31bff65933a3a001ce799b2f791e4bfcea62657d8a5bca
MD5 0bf9b0defc96dc78d0f2ec0dcd550e13
BLAKE2b-256 8c3386fe4305f89e16de3627b72db9b35bd9f28e8830905349b7beb39b427339

See more details on using hashes here.

File details

Details for the file brickdjango-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: brickdjango-0.1.3-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.18

File hashes

Hashes for brickdjango-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f24e03097d0b8c98e769989464ebf1c3e266a1451ce8ecee4a7fb0bfc7637c9e
MD5 60d6d08d8e4966bdd220e63a76ed1815
BLAKE2b-256 704e2abbd631678197b6ede4fba8a632b13ed7697b14f0e7389375557e0d5459

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page