Metadata-Version: 2.1
Name: django-rework
Version: 0.2.2
Summary: Rapid develop framework base on Django
Home-page: https://github.com/rework-union/django-rework
Author: rework union
Author-email: josh.yu_8@live.com
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 3.0
Classifier: Framework :: Django :: 3.1
Classifier: Framework :: Django :: 3.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Internet :: WWW/HTTP
Description-Content-Type: text/markdown
Requires-Dist: Django (<=3.2,>=2.2)
Requires-Dist: django-cors-headers (==3.1.0)
Requires-Dist: django-filter (<3.0,>=2.0)
Requires-Dist: django-mysql (==3.2.0)
Requires-Dist: djangorestframework (<4.0,>=3.10.1)
Requires-Dist: djangorestframework-simplejwt (~=4.4.0)
Requires-Dist: fabric (~=2.5)
Requires-Dist: Markdown (~=3.1)
Requires-Dist: mysqlclient (==1.4.6)
Requires-Dist: Pillow (<=8.1.0,>=6.2.2)
Requires-Dist: drf-nested-routers (~=0.91)
Requires-Dist: drf-yasg (~=1.17)
Requires-Dist: wechatpy (~=1.8)

# Django Rework

[![Downloads](https://pepy.tech/badge/django-rework)](https://pepy.tech/project/django-rework)
[![PyPI](https://img.shields.io/pypi/v/django-rework)](https://pypi.org/project/django-rework/)
[![Python](https://img.shields.io/pypi/pyversions/django)](https://www.python.org)
[![Django](https://img.shields.io/pypi/djversions/django-rework)](https://www.djangoproject.com)
[![License](https://img.shields.io/pypi/l/django-rework)](https://opensource.org/licenses/MIT)

Rapid develop framework base on Django

# _Installation_

```bash
python3 -m pip install django-rework
```

# _Generic CLI Commands_

### Start a new project

```bash
# It will create project in current dir
# eg: initialize a new project named `pony`
rework init pony
```

### Add App

```bash
rework add users
```

### Add deployment configurations

```bash
rework deploy --init
```

### Deploy to test or production

```bash
rework deploy
```

# App docs

| App      | Description | docs in English | 简体中文文档  |
| -------- | ----------- | --------------- | ----------- |
| users    | Users system       | [users.md](docs/users.md) | [users_cn.md](docs/users_cn.md) |


# DevOps Fabric scripts 

## Setup hosts

`django-rework` deal with DevOps using `Fabric`. You should add hosts configurations in `fabfile.py`.

```python
from rework.core.devops.hosts import loads

# The first argument `default` is host alias
# `user` is optional, default value is `root`
# `exclude_components` is optional, it's been used in `fab setup_server`
loads(
    'default', {
        'host': 'your-server-ip',
        'port': 22,
        'user': 'root',
        'password': 'server-password',
        'envs': ['test', 'prod'],
        'exclude_components': ['redis'],
    }
)
```

You can change host alias as you like: `web1` etc.
```bash
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.

```bash
# deploy to `test` environment
fab test deploy
```

If you want to update requirements, you should add arguments `-r` or `--requirements_update`
```bash
fab test deploy -r
```


# _Code Format_

Code format using Google 的 `yapf`，recommend to install `yapf` globally：
```bash
# install yapf using pip in python3
$ python3 -m pip install yapf

# find and create soft link to `/usr/local/bin/yapf`
# find yapf execute file 

$ which yapf
# (/usr/local/python3.6/bin/yapf) possible location

$ ln -s /usr/local/python3.6/bin/yapf /usr/local/bin/yapf
```

# _CONTRIBUTE_

### Developer Environment

```bash
pip install -r requirements_dev.txt
``` 

### Run tests

```bash
python tests/runtests.py
```


### Tag a new release

tag a version:

```bash
git tag -a v0.1.0
```

push tags to remote:

```bash
git push --tags
```


