Advanced Django app creator with customizable architecture templates
Project description
dj-reframe
Advanced Django App Creator with customizable architecture templates.
Description
DjReframe is a Django extension that transforms the standard startapp command. Instead of a generic default structure, DjReframe lets you create applications with specialized architectures (Web, API/DRF, Service Layer, etc.) in seconds. You can use our predefined structures or create your own.
Features
- ๐ Multiple Architecture Templates: Create Django apps with pre-defined architectures
- ๐จ Custom Templates: Use your own templates by adding them to your user folder
- ๐ Cross-Platform: Works on Windows, macOS, and Linux
- ๐ง CLI Interface: Simple command-line interface with clear feedback
- โ Django Validation: Validates app names and prevents common mistakes
Installation
pip install dj-reframe
Or with Poetry:
poetry add dj-reframe
Upgrade
Keep your package up to date with the latest updates
pip install --upgrade dj-reframe
Usage
Basic Usage
Create a new Django app with a specific architecture:
dj-reframe <app_name> <architecture_type>
Examples:
# Create a web app
dj-reframe blog sitev1
# Create a DRF API app
dj-reframe api drf
# Create a WebSocket app
dj-reframe chat websockets
Using Custom Templates
You can create your own templates and use them with DjReframe:
# Open the custom templates folder
dj-reframe --my-templates
This will open the folder where you can add your own architecture templates. Just create a new folder with your template name and add your Django app structure inside it.
๐ Template File Naming Rules
For DjReframe (and Django's startapp) to recognize and properly process your custom templates, all Python files must end with .py-tpl instead of .py.
Why? When Django creates an app from a template, it automatically strips the -tpl suffix. So views.py-tpl becomes views.py in the generated app.
Example of a custom template structure:
my-custom-arch/
โโโ __init__.py-tpl
โโโ admin.py-tpl
โโโ apps.py-tpl
โโโ models.py-tpl
โโโ views.py-tpl
โโโ urls.py-tpl
โโโ migrations/
โ โโโ __init__.py-tpl
โโโ static/
โ โโโ app_name/
โโโ templates/
โโโ app_name/
Important:
- โ
Python files: MUST use
.py-tpl(e.g.,models.py-tpl) - โ
Non-Python files: Use normal extensions (e.g.,
style.css,index.html) - โ
Directories: No special suffix needed (e.g.,
migrations/,templates/)
Once your template is ready, use it with:
dj-reframe <app_name> my-custom-arch
Available Architectures
Click on each architecture to see its complete structure:
sitev1 - Basic Django web application
sitev1/
โโโ __init__.py
โโโ admin.py
โโโ apps.py
โโโ forms.py
โโโ models.py
โโโ tests.py
โโโ urls.py
โโโ views.py
โโโ migrations/
โ โโโ __init__.py
โโโ static/
โ โโโ app_name/
โ โโโ css/
โ โ โโโ style.css
โ โโโ js/
โ โโโ script.js
โโโ templates/
โโโ app_name/
โโโ index.html
sitev2 - Django web app with service layer
sitev2/
โโโ __init__.py
โโโ admin.py
โโโ apps.py
โโโ forms.py
โโโ models.py
โโโ selectors.py
โโโ services.py
โโโ urls.py
โโโ views.py
โโโ migrations/
โ โโโ __init__.py
โโโ static/
โ โโโ app_name/
โ โโโ css/
โ โ โโโ style.css
โ โโโ js/
โ โโโ script.js
โโโ templates/
โ โโโ app_name/
โ โโโ index.html
โโโ tests/
โโโ __init__.py
โโโ test_selectors.py
โโโ test_serices.py
โโโ test_views.py
api - Django REST Framework API
api/
โโโ __init__.py
โโโ admin.py
โโโ apps.py
โโโ forms.py
โโโ models.py
โโโ pagination.py
โโโ permissions.py
โโโ selectors.py
โโโ serializers.py
โโโ services.py
โโโ tests.py
โโโ urls.py
โโโ views.py
โโโ migrations/
โ โโโ __init__.py
โโโ tests/
โโโ __init__.py
โโโ test_api.py
โโโ test_selectors.py
โโโ test_serializers.py
โโโ test_serices.py
api-graphql - GraphQL API with Strawberry/Graphene
api-graphql/
โโโ __init__.py
โโโ admin.py
โโโ apps.py
โโโ inputs.py
โโโ middleware.py
โโโ models.py
โโโ mutations.py
โโโ queries.py
โโโ schema.py
โโโ services.py
โโโ types.py
โโโ urls.py
โโโ utils.py
โโโ migrations/
โ โโโ __init__.py
โโโ tests/
โโโ __init__.py
โโโ test_mutations.py
โโโ test_queries.py
โโโ test_shema.py
โโโ test_types.py
websockets - WebSocket-based application
websockets/
โโโ __init__.py
โโโ admin.py
โโโ apps.py
โโโ auth.py
โโโ consumers.py
โโโ events.py
โโโ exceptions.py
โโโ middleware.py
โโโ models.py
โโโ room.py
โโโ routing.py
โโโ selectors.py
โโโ services.py
โโโ tests.py
โโโ utils.py
โโโ views.py
โโโ migrations/
โ โโโ __init__.py
โโโ tests/
โโโ __init__.py
โโโ test_consumers.py
โโโ test_middleware.py
โโโ test_routing.py
service-layer - Service layer pattern
service-layer/
โโโ __init__.py
โโโ admin.py
โโโ apps.py
โโโ models.py
โโโ selectors.py
โโโ services.py
โโโ urls.py
โโโ views.py
โโโ migrations/
โโโ __init__.py
celery-tasks - Celery async tasks
celery-tasks/
โโโ __init__.py
โโโ admin.py
โโโ apps.py
โโโ models.py
โโโ tasks.py
โโโ urls.py
โโโ views.py
โโโ migrations/
โโโ __init__.py
admin-centric - Django Admin focused
admin-centric/
โโโ __init__.py
โโโ admin.py
โโโ apps.py
โโโ models.py
โโโ urls.py
โโโ views.py
โโโ migrations/
โโโ __init__.py
microservice - Lightweight microservice
microservice/
โโโ __init__.py
โโโ admin.py
โโโ apps.py
โโโ models.py
โโโ serializers.py
โโโ urls.py
โโโ views.py
โโโ migrations/
โโโ __init__.py
ml-integration - Machine Learning integration
ml-integration/
โโโ __init__.py
โโโ admin.py
โโโ apps.py
โโโ ml_utils.py
โโโ models.py
โโโ urls.py
โโโ views.py
โโโ migrations/
โโโ __init__.py
Or create your own custom templates!
Requirements
- Python >= 3.10
- Django >= 4.0
Development
Running Tests
pytest tests/
Code Quality
This project uses:
- Ruff for linting and formatting
- MyPy for type checking
- Pre-commit hooks for automated checks
Setup pre-commit hooks:
pre-commit install
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Repository
GitHub: https://github.com/DougVikt/dj-reframe
Issues
If you encounter any issues or have suggestions, please file an issue on the GitHub Issues page.
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 dj_reframe-0.1.0.tar.gz.
File metadata
- Download URL: dj_reframe-0.1.0.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.12.13 Linux/6.17.0-1010-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0472ed62f8bb9de15818096b8e9ed98d3819aa76fbd421c05f626ad976fa45f3
|
|
| MD5 |
cc9d314cad56c23a073c0c28a742b585
|
|
| BLAKE2b-256 |
12fb69514d055972257b02d9dad8e098f4fa8e0f9fd1920f53b10d1c7c042166
|
File details
Details for the file dj_reframe-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dj_reframe-0.1.0-py3-none-any.whl
- Upload date:
- Size: 44.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.12.13 Linux/6.17.0-1010-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41851bc5cb38ca0a907ff5acacf54c0d96a0887579adfacb31bfba86984d8d7e
|
|
| MD5 |
187bc49c770b9b7c9cec7aa6d8d25ae9
|
|
| BLAKE2b-256 |
c09f967369ce8dcd8a50b16971ae17f1b97490358696233c723a6d1d36128436
|