Skip to main content

Django Rework

Downloads PyPI Python Django License

Rapid develop framework base on Django and Django-Ninja, with non-verbose Django development experience.

Inspired by RailgunS

Installation & Cli commands

Requirements

  • Python >= 3.9
  • Django >= 3.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',
)

🥭 Build-in custom exceptions

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:

  1. environment name: dev, test, prod
  2. 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

Download files

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

Source Distribution

django_rework-0.8.0.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

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

django_rework-0.8.0-py3-none-any.whl (47.6 kB view details)

Uploaded Python 3

File details

Details for the file django_rework-0.8.0.tar.gz.

File metadata

  • Download URL: django_rework-0.8.0.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for django_rework-0.8.0.tar.gz
Algorithm Hash digest
SHA256 eb7fcefb00fe70a8b1c0d37db51506504e71c84d77baaa2494e5669441a8f36f
MD5 e3474cec55eb800650a5974be75d3948
BLAKE2b-256 0dd818857364ac9ce03e32db7616a957833bd4841ecdaa804c7435cfa4d2cbae

See more details on using hashes here.

File details

Details for the file django_rework-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: django_rework-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 47.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for django_rework-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b98fd3d170ec267d83393a76c1445ce6842d81834e4563f723309068b763b19
MD5 f97069438a357e79c0802a4e536f67c2
BLAKE2b-256 29dbec23edebf42eedfd985a7f4ed5a2a19b0ef53149dd6b9d31c715fd80d789

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.1

2 files

0.6.0

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.3

2 files

0.3.2

2 files

0.3.0

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.3

3 files

0.1.2

2 files

0.1.1

3 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page