comring-0.2.3
توضیحات
Comring, the PTI ERP companion tool
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | comring-0.2.3 |
| نام | comring |
| نسخه کتابخانه | 0.2.3 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Agustianes Umbara Suwardi |
| ایمیل نویسنده | anezch@gmail.com |
| آدرس صفحه اصلی | https://github.com/ausuwardi/comring |
| آدرس اینترنتی | https://pypi.org/project/comring/ |
| مجوز | - |
Comring
=======
Comring is a companion tool for Paragon ERP.
## Building from Source
```
python3 setup.py sdist bdist_wheel
```
Optionally, release to pypi:
```
python3 -m twine upload dist/*
```
## Installing
Install using pip
```
pip install comring
```
## Odoo Environments Configuration
The system will read Odoo servers (environments) configuration from `$HOME/.config/odoopti.yaml` file:
```yaml
environments:
live:
name: Odoo Live
url: https://odoo.pti-cosmetics.com
database: paragon
kind: live
user: toolbox
password: secretpass
local-testing:
name: Local Testing
url: http://localhost:8069
database: test
kind: live
user: admin
password: 1
...
```
Description for each environment configuration keys:
1. `name`: Name or label
2. `url`: Server url
3. `database`: Database to be used
4. `kind`: Implementation. Valid values are: live, spinoff, nbm
5. `user`: The user to be used when communicating with the server
6. `password`: Password for the user
## Web App
### Development Mode with Flask Built-in Server
#### Environment Variables
The web app uses flask as engine, these variables can be set to configure the app. You can refer to flask docs for a complete reference. This project also uses python-dotenv so you can create .env file to set env vars more easily. The three most important variables are:
```
FLASK_RUN_HOST=0.0.0.0
FLASK_RUN_PORT=5555
FLASK_ENV=development
```
#### Running with Self-Signed SSL certificate
To generate a self-signed SSL certificate:
```
openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365
```
Add this to .env:
```
FLASK_RUN_CERT=cert.pem
FLASK_RUN_KEY=key.pem
```
#### Running Development Server
To run web app:
```
flask run
```
### Production Mode with CherryPI's WSGI Server
Run the webapp for the first time:
```bash
python3 -m comring.webapp [-a bind_address] [-p bind_port]
```
Wait for about 3 seconds, then press CTRL+C to stop the application. Next you will need to generate a secret key for this production server:
```bash
python -c 'import os; print("SECRET_KEY =", os.urandom(16))' > venv/var/comring.webapp-instance/config.py
```
Then run the application again. The cookie encryption will now use the generated secret key above.
### Performance Testing
In this example we'll use apache-util's `ab` testing tool to stress test the web application.
### Requirements
`ab` available from `apache2-utils` package
```
sudo apt-get install apache2-utils
```
### Run application
Run in development mode or production mode. You may also test remotely deployed application.
### Get a Sesssion Cookie
Open the application in browser, then login. We will reuse the cookie used by the browser in `ab`:
1. Open developer tool
2. In the 'Application' or 'Storage' menu, search for Cookies
3. Copy the session cookie value
### Run ab
To run 160 requests split into 80 concurrent users:
```
ab -n 160 -c 80 -C session=<cookie valued copied from browser> -p benchmark/post-invoice-small.data -T 'application/x-www-form-urlencoded' http://localhost:5500/invoice/by_brand
```
### Alternative: siege
Create `.siegerc` file to set server address and login credentials:
```
SERVER_URL = http://localhost:5555
login-url = ${SERVER_URL}/auth/login POST environment=live&username=myuser&password=mypassword
```
Adjust url and parameters to suit your need, then run siege:
```
siege -f benchmark/siege-local-small.txt -b -c 80 -r 2
```
Read siege manual for more information on how to use it.
نیازمندی
| مقدار | نام |
|---|---|
| - | flask |
| - | cheroot |
| - | cryptography |
| - | requests |
| - | python-dotenv |
| - | PyYAML |
| - | pika |
| - | xlrd |
| - | prettytable |
| - | cachetools |
| - | wsgi-request-logger |
| - | coloredlogs |
| - | psycopg2 |
| - | loguru |
نحوه نصب
نصب پکیج whl comring-0.2.3:
pip install comring-0.2.3.whl
نصب پکیج tar.gz comring-0.2.3:
pip install comring-0.2.3.tar.gz