Multi-adaptable and lightweight server framework based on Flask
Project description
Miniagent
Miniagent is a multi-adaptable and lightweight server framework based on Flask.
Installing
Install and update using pip:
$ pip install -U miniagent
Example code download
Create an example project after installing miniagent
$ mini-project tanminkwan/local-agent test_project
Then test_project directory and files are created like the tree below.
└── test_project
├── run.py
├── config.py
└── myapp
├── __init__.py
├── adaptee.py
├── adapter.py
├── dbquery.py
├── executer.py
└── model
├── __init__.py
└── mymodels.py
A Simple Example
There must be two files config.py and run.py in the base directory.
# this is a sample config.py
import os
from datetime import datetime, timedelta
COMMANDER_SERVER_URL = 'http://localhost:8809'
base_dir = os.path.abspath(os.path.dirname(__file__))
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(base_dir, 'app.db')
CUSTOM_MODELS_PATH = "example.model"
DEFAULT_ADAPTEES =\
{
"example.adapter.printer_adapters.PrinterAdapter":
"example.adaptee.tadaptees.CardPrinterAdaptee",
"example.adapter.payment_adapters.PaymentAdapter":
"example.adaptee.tadaptees.CreditCardPaymentAdaptee",
}
SCHEDULED_JOBS =\
[
{
"executer":"example.executer.scheduler.DeviceHealth",
"trigger":"interval",
"id":"DeviceHealth",
"name":"Devices Health Check",
"minutes":5,
"start_date":datetime.now()+timedelta(minutes=1)
}
]
# save this as run.py
from miniagent import app
app.run(host="0.0.0.0", port=17080, use_reloader=False, debug=True)
$ python run.py
* Running on http://127.0.0.1:17080/ (Press CTRL+C to quit)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
miniagent-0.0.5-py3-none-any.whl
(12.5 kB
view hashes)
Close
Hashes for miniagent-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f83247db511567d331d2c3f69d7387248cba230cb9088bd493a8ea24a753e1b |
|
MD5 | 5631c2273ebb3bdc5293ee3958b4ce9c |
|
BLAKE2b-256 | 11a89e48258a6bce949d82cf1b91e959a74cb77aea8d8422ac9615526a4b33f1 |