An opinionated Django project setup tool
Project description
porosdjango
An opinionated CLI tool that bootstraps Django projects with production-ready defaults. Get a custom user model, Django REST Framework, optional Docker integration with full observability, and sensible project structure in seconds.
Features
- Custom User model out of the box (email-based authentication)
- Django REST Framework pre-configured
- Helpers module with
BaseModel(UUID primary key, timestamps, soft delete) - Configurable project and app names
- Input validation for project and app names
- Auto-generated
.gitignorefor Django projects - Automatic dependency installation
- Database migrations run automatically
- Optional Docker integration with:
- PostgreSQL, Redis, Nginx, and Celery (worker, beat, flower)
- Prometheus + Grafana monitoring with pre-built dashboards
- Mailpit for local email testing
- Environment-based configuration via
.env
Prerequisites
- Python 3.11 or higher
- pip (comes with Python)
To check your Python version:
python --version
If you see something below 3.11, you'll need to upgrade Python before using porosdjango.
Usage Guide
This is a step-by-step guide to creating a new Django project using porosdjango.
Step 1: Create and activate a virtual environment
It's recommended to use a virtual environment so your project dependencies are isolated from your system Python.
macOS / Linux:
mkdir myproject
cd myproject
python3 -m venv .venv
source .venv/bin/activate
Windows (PowerShell):
mkdir myproject
cd myproject
python -m venv .venv
.venv\Scripts\Activate.ps1
Windows (Command Prompt):
mkdir myproject
cd myproject
python -m venv .venv
.venv\Scripts\activate.bat
Once activated, your terminal prompt will show (.venv) at the beginning.
Step 2: Install porosdjango
pip install porosdjango
This installs porosdjango along with its dependencies (Django, Click, Jinja2, and Requests).
Step 3: Create your project
porosdjango create
You'll be walked through an interactive setup:
-
Project app name — This is the name of your Django configuration module (the folder that contains
settings.py,urls.py, etc.). The default isconfig, which is a common convention. Press Enter to accept the default, or type a name likemysiteorcore. -
Custom app — You'll be asked if you want to create a custom app. If you say yes, you'll be prompted for the app name (e.g.,
blog,accounts,products). This is the app where you'll write most of your project-specific code (models, views, etc.). -
Docker integration — You'll be asked if you want Docker support. If you say yes, you'll provide a project name used for service naming, and the tool will generate a full Docker Compose stack with PostgreSQL, Redis, Celery, Nginx, Prometheus, Grafana, and more.
Here's what a typical session looks like:
$ porosdjango create
What would you like to name your Django project app (default: config)? config
Would you like to create a custom app? [Y/n]: y
What would you like to name your application? blog
Would you like to add Docker integration? [y/N]: y
What is the name of your project? myproject
Creating requirements.txt...
Installing dependencies...
Dependencies installed successfully.
Creating Django project with app name 'config'...
Creating application 'blog'...
Creating helpers module...
Creating auth_app...
Setting up custom User model and UserManager...
Updating settings.py...
Creating .gitignore...
Running migrations...
Setting up Docker integration...
Creating Docker infrastructure files...
Updating settings for Docker...
Setup complete!
Run your project with:
python manage.py runserver
To start with Docker:
cp .env.example .env
docker compose up --build
Step 4: Run the development server
python manage.py runserver
Open your browser and go to http://127.0.0.1:8000/. You should see the Django welcome page.
Step 5: Create a superuser (optional)
To access the Django admin panel at http://127.0.0.1:8000/admin/:
python manage.py createsuperuser
Since porosdjango sets up an email-based User model, you'll be prompted for an email and password (not a username).
Step 6: Start building
You now have a production-ready Django project. Here are some common next steps:
- Add models to your custom app (e.g.,
blog/models.py) - Your models can extend
BaseModelfrom the helpers module to get UUID primary keys,created_at,updated_at, anddeleted_atfields for free:
from helpers.db_helpers import BaseModel
from django.db import models
class Post(BaseModel):
title = models.CharField(max_length=200)
content = models.TextField()
- Create views and URL patterns in your custom app
- Add DRF serializers and viewsets for your API
- Run
python manage.py makemigrations && python manage.py migrateafter adding or changing models
What Gets Generated
Base project
myproject/
├── config/ # Your Django project (or custom name)
│ ├── __init__.py
│ ├── asgi.py
│ ├── settings.py # Pre-configured with your apps
│ ├── urls.py
│ └── wsgi.py
├── auth_app/ # Custom user model app
│ ├── migrations/
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── managers.py # Custom UserManager
│ ├── models.py # Custom User model (email-based)
│ ├── tests.py
│ └── views.py
├── helpers/ # Base model utilities
│ ├── __init__.py
│ └── db_helpers.py # BaseModel with UUID, timestamps, soft delete
├── your_app/ # Your custom app (if created)
├── manage.py
├── requirements.txt # Pinned Django and DRF versions
└── .gitignore # Django-specific gitignore
With Docker integration
When you opt in to Docker, these additional files are generated:
myproject/
├── config/
│ ├── __init__.py # Updated with Celery auto-discovery
│ ├── celery.py # Celery app configuration
│ └── settings.py # Updated with Docker-aware settings
├── docker-compose.yml # Full multi-service stack
├── .dockerignore
├── .env.example # Environment variable template
└── infrastructure/docker/
├── Dockerfile
├── scripts/
│ ├── dev.sh # Django dev server entrypoint
│ ├── celery_worker.sh # Celery worker entrypoint
│ ├── celery_beat.sh # Celery beat entrypoint
│ └── flower.sh # Flower monitoring entrypoint
├── nginx/
│ └── nginx.conf
├── prometheus/
│ ├── prometheus.yml
│ └── alert_rules.yml
├── alertmanager/
│ └── alertmanager.yml
└── grafana/
└── provisioning/
├── datasources/
│ └── datasource.yml
└── dashboards/
├── dashboard.yml
└── json/
├── django-app.json
├── infrastructure.json
└── celery.json
Generated Configuration
The tool automatically configures settings.py with:
INSTALLED_APPS = [
# ... default Django apps
'rest_framework',
'auth_app',
'your_app', # if created
]
AUTH_USER_MODEL = 'auth_app.User'
Docker settings
When Docker integration is enabled, settings.py is further updated with:
- Environment-based config —
SECRET_KEY,DEBUG, andALLOWED_HOSTSread from environment variables with sensible defaults - PostgreSQL — Uses PostgreSQL when
POSTGRES_DBis set, falls back to SQLite otherwise - Redis cache — Configured via
REDIS_URL - Celery — Broker and result backend via Redis, with
django-celery-beatscheduler - Prometheus —
django_prometheusadded to apps and middleware, metrics endpoint at/metrics - Email — Configured for Mailpit in development (SMTP on port 1025, UI at
localhost:8025) - Static files —
STATIC_ROOTset for Nginx to serve collected static files
Docker services
The generated docker-compose.yml includes 17 services:
| Category | Services |
|---|---|
| Application | Django (web), Celery worker, Celery beat, Flower |
| Data | PostgreSQL 16, Redis 7 |
| Reverse proxy | Nginx |
| Mailpit (SMTP + web UI) | |
| Monitoring | Prometheus, Grafana (with 3 pre-built dashboards), Alertmanager |
| Exporters | Node, cAdvisor, PostgreSQL, Redis, Nginx, Celery |
Getting started with Docker
# Copy the environment template and adjust as needed
cp .env.example .env
# Build and start all services
docker compose up --build
Once running, the key endpoints are:
| Service | URL |
|---|---|
| Django | http://localhost:8000 |
| Nginx | http://localhost |
| Grafana | http://localhost:3000 |
| Prometheus | http://localhost:9090 |
| Flower | http://localhost:5555 |
| Mailpit | http://localhost:8025 |
App Naming Rules
Project and app names must be valid Python identifiers:
- Use only letters, numbers, and underscores
- Don't start with a number
- Don't use Python reserved words (
class,import,for, etc.) - Don't use Django reserved names (
django,test,site,admin)
Valid examples: blog, my_app, products, user_profiles
Invalid examples: my-app (hyphens), 2fast (starts with number), class (reserved word)
Development
# Clone the repository
git clone https://github.com/Toluwalemi/porosdjango.git
cd porosdjango
# Create a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install in development mode with dev dependencies
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install
# Run tests
pytest
Contributing
See CONTRIBUTING.md for guidelines on how to contribute to this project.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
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
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 porosdjango-1.0.0.tar.gz.
File metadata
- Download URL: porosdjango-1.0.0.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5b8ebc3e1a27147024e6bbcda7c1923b3dc8e94ea96f2dea9ef0fa792576063
|
|
| MD5 |
19e775cac9e6d76e68e4644248818962
|
|
| BLAKE2b-256 |
f38d1bcfddb49e9f5b94658286a2e86b4c4214550057a583521fe2fcc9fb592a
|
Provenance
The following attestation bundles were made for porosdjango-1.0.0.tar.gz:
Publisher:
publish.yml on Toluwalemi/porosdjango
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
porosdjango-1.0.0.tar.gz -
Subject digest:
d5b8ebc3e1a27147024e6bbcda7c1923b3dc8e94ea96f2dea9ef0fa792576063 - Sigstore transparency entry: 938607431
- Sigstore integration time:
-
Permalink:
Toluwalemi/porosdjango@9a25dde47ae34ebf3e91b0f8c5a9c081746018b1 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Toluwalemi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9a25dde47ae34ebf3e91b0f8c5a9c081746018b1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file porosdjango-1.0.0-py3-none-any.whl.
File metadata
- Download URL: porosdjango-1.0.0-py3-none-any.whl
- Upload date:
- Size: 32.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5287f43a2504e4ca94b6082ee812e3131ceca1917a5cf19ec26c55e726d8b01f
|
|
| MD5 |
83658692a61286c107bceed9783287e7
|
|
| BLAKE2b-256 |
f2d340961ecdea564ef177f63056cdebbabf0bfd224e9b93156a81897956582d
|
Provenance
The following attestation bundles were made for porosdjango-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on Toluwalemi/porosdjango
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
porosdjango-1.0.0-py3-none-any.whl -
Subject digest:
5287f43a2504e4ca94b6082ee812e3131ceca1917a5cf19ec26c55e726d8b01f - Sigstore transparency entry: 938607440
- Sigstore integration time:
-
Permalink:
Toluwalemi/porosdjango@9a25dde47ae34ebf3e91b0f8c5a9c081746018b1 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Toluwalemi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9a25dde47ae34ebf3e91b0f8c5a9c081746018b1 -
Trigger Event:
release
-
Statement type: