websoft9/appmanage/docs/DEV-SETUP.md

74 lines
1.8 KiB
Markdown
Raw Normal View History

2023-07-21 16:14:35 +08:00
# Dev-Setup
2023-04-10 14:52:59 +08:00
2023-08-26 15:57:05 +08:00
AppManage is based Python, and you should read the [Architecture docs](./architecture.md) if you want to contributing code for it.
## Code format
You can refer to [PEP 8 Style Guide for Python Code](https://peps.python.org/pep-0008/) and use fomatter tool [Black](https://github.com/psf/black):
```
pip install black
black {source_file_or_directory}
```
## Test
2023-08-28 12:16:19 +08:00
You can test function,class,module and unit by automatic tools [Unittest](https://docs.python.org/3/library/unittest.html)
2023-08-26 15:57:05 +08:00
2023-08-22 17:29:08 +08:00
## Development runtime
You can use Windows/Linux/Mac for AppMange development if you have Docker and Python3.8 on you machine.
2023-04-10 13:36:02 +08:00
2023-08-28 12:16:19 +08:00
1. Prepare a Linux (not use WSL) instance for development
2023-04-10 14:13:58 +08:00
2023-08-28 12:16:19 +08:00
2. Connect your local IDE to Linux for codespace
2023-04-10 13:46:02 +08:00
2023-08-28 12:16:19 +08:00
3. Install websoft9 on you Linux
```
wget https://websoft9.github.io/websoft9/install/install.sh && bash install.sh
```
2023-08-22 17:29:08 +08:00
2023-08-28 12:16:19 +08:00
4. Running below commands to create project on remote Linux
2023-08-22 17:29:08 +08:00
```
2023-08-28 12:16:19 +08:00
git clone --depth=1 https://github.com/Websoft9/websoft9.git
cd websoft9/appmanage
pip install -r requirements.txt
2023-08-22 17:29:08 +08:00
```
2023-08-28 12:16:19 +08:00
5. Once you have change code, you should build your AppManage docker image and running it
2023-08-22 17:29:08 +08:00
```
cd websoft9/appmanage && docker build -t websoft9dev/appmanage:latest-pr .
cd websoft9/docker/appmanage && export APP_VERSION=latest-pr && docker compose up -d
```
2023-08-25 15:47:50 +08:00
## Structure
### API
```
├── api
│   ├── exception
│   ├── model -- Data models and database schema
│   ├── service -- Controllers
│   ├── utils -- Common modules and tools
│   └── v1 -- Views
```
2023-08-24 10:59:39 +08:00
### Route
New API use apps.router, don't create a new route
### Post method
Support [get,post] submit
### API URL
2023-04-10 16:39:45 +08:00
2023-08-22 15:29:54 +08:00
Access API by: **http://Internet IP:5000/docs**
2023-04-11 09:40:16 +08:00
2023-07-20 17:51:24 +08:00
### Test Automation
2023-04-10 16:39:45 +08:00
2023-08-22 17:29:08 +08:00
Coming soon...