Skip to main content

Non-verbose Django development experience

Project description

Django Rework

Downloads PyPI Python Django License

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

Installation & Cli commands

Requirements

  • Python >= 3.8
  • Django >= 3.2
  • 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

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

django-rework-0.6.1.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

django_rework-0.6.1-py3-none-any.whl (48.3 kB view details)

Uploaded Python 3

File details

Details for the file django-rework-0.6.1.tar.gz.

File metadata

  • Download URL: django-rework-0.6.1.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for django-rework-0.6.1.tar.gz
Algorithm Hash digest
SHA256 71401d50bd700f1f442efa9e10654f7a9787b59f7fc5a3ffb215c9da6f4fa8a3
MD5 03b27f96f10d3b4a89974f50e3760cd3
BLAKE2b-256 8a5759ccb0e1bf8cac9b1793ea3984fe13a01b86949c2a5f9d0ab902a038ac3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_rework-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 467e28a6ed5750927a011aef156c8678f0da0dfe9decb3e3a72b2fa733ca4766
MD5 1f6e7febaf7524eab247bea36de10078
BLAKE2b-256 0cfc164da882972896e340a4abd2af448a671d418c59bc45f30a5fc97408e68b

See more details on using hashes here.

Supported by

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