Skip to content

Commit

Permalink
使用 pyyaml,配置文件、代码做相应调整
Browse files Browse the repository at this point in the history
Signed-off-by: leeyi <[email protected]>
  • Loading branch information
leeyisoft committed Sep 24, 2019
1 parent 30e34b8 commit 1108dc1
Show file tree
Hide file tree
Showing 25 changed files with 633 additions and 475 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ gino = "*"

[packages]
tornado = "*"
pyyaml = "*"
mysqlclient = "*"
sqlalchemy = "*"
sqlalchemy-utils = "*"
redis = "==2.10.6"
rsa = "*"
pycryptodome = "*"
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ tree -I '*svn|*node_module*|*git|py3|*.pyc|__pycache__|statics'
│   └── app2
│   └── app3
├── configs
│   ├── dev.ini
│   └── local.ini
│   ├── dev.yaml
│   └── local.yaml
├── datas
│   ├── locales
│   │   ├── en_US.csv
Expand All @@ -70,10 +70,10 @@ tree -I '*svn|*node_module*|*git|py3|*.pyc|__pycache__|statics'

* .env 环境配置文件,只有一个section [sys],一个变量 TREST_ENV
* configs 应用配置文件
* configs/local.ini 本地开发环境相关配置
* configs/dev.ini 开发环境相关配置
* configs/test.ini 测试环境相关配置
* configs/product.ini 生产环境相关配置
* configs/local.yaml 本地开发环境相关配置
* configs/dev.yaml 开发环境相关配置
* configs/test.yaml 测试环境相关配置
* configs/product.yaml 生产环境相关配置
* applications 应用rest api相关代码
* applications/common/models 公共应用数据模型层
* applications/common/services 公共应用服务层
Expand Down Expand Up @@ -148,20 +148,21 @@ if __name__ == "__main__":
在 项目根目录( ROOT_PATH ) 下面创建 [.env 文件](https://gitee.com/leeyi/trest/blob/master/demo_dot.env)
```
# TREST_ENV is not one of the local, dev, test, or product
[sys]
TREST_ENV = dev
TREST_ENV : dev
```

run
```
pipenv install --skip-lock
pipenv shell
python server.py --port=5080
python tests/app_demo/server.py --port=5081
```

f'{ROOT_PATH}/configs/{env}.ini' demo
f'{ROOT_PATH}/configs/{env}.yaml' demo

like this [./tests/app_demo/configs/dev.ini](https://gitee.com/leeyi/trest/blob/master/tests/app_demo/configs/dev.ini)
like this [./tests/app_demo/configs/dev.yaml](https://gitee.com/leeyi/trest/blob/master/tests/app_demo/configs/dev.yaml)

# [开发约定](https://gitee.com/leeyi/trest/blob/master/promise.md)

Expand Down
21 changes: 11 additions & 10 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ tree -I '*svn|*node_module*|*git|py3|*.pyc|__pycache__|statics'
│   └── app2
│   └── app3
├── configs
│   ├── dev.ini
│   └── local.ini
│   ├── dev.yaml
│   └── local.yaml
├── datas
│   ├── locales
│   │   ├── en_US.csv
Expand All @@ -70,10 +70,10 @@ tree -I '*svn|*node_module*|*git|py3|*.pyc|__pycache__|statics'

* .env 环境配置文件,只有一个section [sys],一个变量 TREST_ENV
* configs 应用配置文件
* configs/local.ini 本地开发环境相关配置
* configs/dev.ini 开发环境相关配置
* configs/test.ini 测试环境相关配置
* configs/product.ini 生产环境相关配置
* configs/local.yaml 本地开发环境相关配置
* configs/dev.yaml 开发环境相关配置
* configs/test.yaml 测试环境相关配置
* configs/product.yaml 生产环境相关配置
* applications 应用rest api相关代码
* applications/common/models 公共应用数据模型层
* applications/common/services 公共应用服务层
Expand Down Expand Up @@ -148,20 +148,21 @@ if __name__ == "__main__":
在 项目根目录( ROOT_PATH ) 下面创建 [.env 文件](https://gitee.com/leeyi/trest/blob/master/demo_dot.env)
```
# TREST_ENV is not one of the local, dev, test, or product
[sys]
TREST_ENV = dev
TREST_ENV : dev
```

run
```
pipenv install --skip-lock
pipenv shell
python server.py --port=5080
python tests/app_demo/server.py --port=5081
```

f'{ROOT_PATH}/configs/{env}.ini' demo
f'{ROOT_PATH}/configs/{env}.yaml' demo

like this [./tests/app_demo/configs/dev.ini](https://gitee.com/leeyi/trest/blob/master/tests/app_demo/configs/dev.ini)
like this [./tests/app_demo/configs/dev.yaml](https://gitee.com/leeyi/trest/blob/master/tests/app_demo/configs/dev.yaml)

# [开发约定](https://gitee.com/leeyi/trest/blob/master/promise.md)

Expand Down
3 changes: 1 addition & 2 deletions demo_dot.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# TREST_ENV is not one of the local, dev, test, or product
[sys]
TREST_ENV = dev
TREST_ENV : dev
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
platforms='any',
install_requires=[
'tornado>=6.0.0',
'pyyaml',
'mysqlclient',
'sqlalchemy',
'sqlalchemy-utils',
'redis==2.10.6',
'rsa',
'pycryptodome',
Expand Down
98 changes: 0 additions & 98 deletions tests/app_demo/configs/dev.ini

This file was deleted.

Loading

0 comments on commit 1108dc1

Please sign in to comment.