Seatools Flask Web Starter
Project description
Seatools Flask Starter
This framework must be used in conjunction with the seatools-starter-server-* packages, using seatools-starter-server-uvicorn as an example here.
Usage Guide
- Install with
poetry add flask seatools-starter-server-uvicorn seatools-starter-web-flask - Configure
config/application.ymlas follows:
seatools:
server:
# Here are the uvicorn parameter configurations
uvicorn:
host: 0.0.0.0
port: 8000
workers: 1
reload: true
# Here are the Flask configurations
flask:
# Consistent with Flask parameters
import_name: seatools.ioc.server.app
static_folder: static
template_folder: templates
...
- Usage, load by defining ioc container functions
import abc
from seatools.ioc import Autowired, Bean
from flask import Flask
# Add route
from flask import Flask
@Bean
def api_controller(app: Flask):
@app.get('/')
def hello():
return 'hello flask'
class Service(abc.ABC):
def hello(self):
raise NotImplementedError
# Flask integration with seatools ioc injection
@Bean
class ServiceA(Service):
def hello(self):
return "serviceA"
@Bean
def a2_router(app: Flask, service: Service): # Specific injection method see seatools
@app.get('/service')
def service():
return service.hello() # return hello flask
- Run, see
seatools-starter-server-*, example:seatools-starter-server-uvicorn
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file seatools_starter_web_flask-1.0.2.tar.gz.
File metadata
- Download URL: seatools_starter_web_flask-1.0.2.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a411788710cb755cd2a4a41b9c3ffcc7b34f0f175721b3941116f9bc2b0282c
|
|
| MD5 |
5095982e0aa733117288bee0be9ad94f
|
|
| BLAKE2b-256 |
794f1a663426ccaaeba85a0894ce6b4a77df9a5f8feeb0ea96840335b9169ba8
|
File details
Details for the file seatools_starter_web_flask-1.0.2-py3-none-any.whl.
File metadata
- Download URL: seatools_starter_web_flask-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6a9fbe359823fb90ff2a2e1337861213df141a229e0c22fcd771e6d929acf6e
|
|
| MD5 |
fa2e3c5eee43a58617cc1c9a602e91c1
|
|
| BLAKE2b-256 |
51b55b9b361203de171d819efedd4dc218f8f071f049cfb058bafc9043e4dc0f
|