Django Rework
Rapid develop framework base on Django and Django-Ninja, with non-verbose Django development experience.
Inspired by RailgunS
Installation & Cli commands
Requirements
- Python >= 3.10
- Django >= 4.2
- Django-Ninja >= 1.3
- Django REST framework >=3.13,<4.0
Install django-rework
pip install django-rework
Generic CLI Commands
Start a new project
# It will create project in current dir
# eg: initialize a new project named `pony`
rework init pony
Add build-in contrib Apps
rework add users
Add deployment configurations
rework deploy --init
Deploy to test or production
rework deploy # or 'fab -H web1 deploy'
Core docs
Custom exceptions
The exception handler must also be configured in your settings, using the EXCEPTION_HANDLER setting key. For example:
REST_FRAMEWORK = {
'EXCEPTION_HANDLER': 'rework.core.views.exception_handler'
}
Use build-in custom exceptions:
from rework.core.exceptions import ValidateError
ValidateError(
detail='You do not have permission to perform this action.',
code='permission_denied',
)
App docs
| App | Description | docs in English | 简体中文文档 |
|---|---|---|---|
| users | Users system | users.md | users_cn.md |
DevOps Fabric scripts
Setup hosts
django-rework deal with DevOps using Fabric. You should add hosts configurations in fabfile.py.
import os
from rework.core.devops.hosts import loads
# The first argument `default` is host alias
# `user` is optional, default value is `root`
# `envs` is the server support deploy environments
# `exclude_components` is optional, it's been used in `fab setup_server`
loads(
'default', {
'host': 'your-server-ip',
'port': 22,
'user': 'root',
'connect_kwargs': {
'password': 'server-password',
},
'envs': ['test', 'prod'],
'exclude_components': ['redis'],
}
)
# Using SSH key
loads(
'web1', {
'host': 'your-server-ip',
'connect_kwargs': {
'key_filename': os.path.join(os.path.abspath('.'), '.deploy/private.pem'),
},
}
)
You can change host alias as you like: web1 etc.
fab -H web1 deploy
if not -H provided, the default alias will use according the order below:
- environment name:
dev,test,prod default
Deploy environments
By default, environments is dev, test, prod, every environment name is a generic fabric tasks.
# deploy to `test` environment
fab test deploy
If you want to update requirements, you should add arguments -r or --requirements_update
fab test deploy -r
Metadata
Release files for django-rework 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_rework-0.9.0.tar.gz | 32.6 kB | Without provenance | Details for django_rework-0.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_rework-0.9.0-py3-none-any.whl | Python 3 | none | any | Details for django_rework-0.9.0-py3-none-any.whl |
Total release size: 80.5 kB
Release files / django_rework-0.9.0.tar.gz
| Download URL | django_rework-0.9.0.tar.gz |
|---|---|
| Size | 32.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6fccffdf0f5a1b07cff2b78fc23c5618d51fc6fb0f3f9abcd519659d34f71509
|
|
BLAKE2b-256 checksum How to use checksums |
4bc4de3a4d57921c93411290fd264a818f090087fe6c2eb460050d9bcea86157
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / django_rework-0.9.0-py3-none-any.whl
| Download URL | django_rework-0.9.0-py3-none-any.whl |
|---|---|
| Size | 47.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7507006951c93bddffc0af1d0058a7ec8188f6595b0c9d364d8458374a5047c
|
|
BLAKE2b-256 checksum How to use checksums |
29b4da8aa33974e8227b0733a2c135e20a565d76ee01219d37c02b041fd82e6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Security for django-rework 0.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.