seatools-starter-web-flask


Nameseatools-starter-web-flask JSON
Version 1.0.1 PyPI version JSON
download
home_pageNone
SummarySeatools Flask Web Starter
upload_time2024-12-26 10:10:48
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords seatools starter
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.

[中文文档](./README_zh.md)

## Usage Guide
1. Install with `poetry add flask seatools-starter-server-uvicorn seatools-starter-web-flask`
2. Configure `config/application.yml` as follows:
```yaml
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
    ...
```
3. Usage, load by defining ioc container functions

```python
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
```
3. Run, see `seatools-starter-server-*`, example: [`seatools-starter-server-uvicorn`](https://gitee.com/seatools-py/seatools-starter-server-uvicorn)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "seatools-starter-web-flask",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "seatools, starter",
    "author": null,
    "author_email": "seatools-py <521274311@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/d7/0b/51c03449b907ecf7e993f962baa35aea7f496f2fe76485ec3c3e6177c2c3/seatools_starter_web_flask-1.0.1.tar.gz",
    "platform": null,
    "description": "# Seatools Flask Starter\n\nThis framework must be used in conjunction with the `seatools-starter-server-*` packages, using `seatools-starter-server-uvicorn` as an example here.\n\n[\u4e2d\u6587\u6587\u6863](./README_zh.md)\n\n## Usage Guide\n1. Install with `poetry add flask seatools-starter-server-uvicorn seatools-starter-web-flask`\n2. Configure `config/application.yml` as follows:\n```yaml\nseatools:\n  server:\n    # Here are the uvicorn parameter configurations\n    uvicorn:\n      host: 0.0.0.0\n      port: 8000\n      workers: 1\n      reload: true\n  # Here are the Flask configurations\n  flask:\n    # Consistent with Flask parameters\n    import_name: seatools.ioc.server.app\n    static_folder: static\n    template_folder: templates\n    ...\n```\n3. Usage, load by defining ioc container functions\n\n```python\nimport abc\nfrom seatools.ioc import Autowired, Bean\nfrom flask import Flask\n\n# Add route\nfrom flask import Flask\n\n@Bean\ndef api_controller(app: Flask):\n    @app.get('/')\n    def hello():\n        return 'hello flask'\n\nclass Service(abc.ABC):\n    \n    def hello(self):\n        raise NotImplementedError\n\n# Flask integration with seatools ioc injection\n@Bean\nclass ServiceA(Service):\n\n    def hello(self):\n        return \"serviceA\"\n\n@Bean\ndef a2_router(app: Flask, service: Service):  # Specific injection method see seatools\n\n    @app.get('/service')\n    def service():\n        return service.hello() # return hello flask\n```\n3. Run, see `seatools-starter-server-*`, example: [`seatools-starter-server-uvicorn`](https://gitee.com/seatools-py/seatools-starter-server-uvicorn)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Seatools Flask Web Starter",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/seatools-py/seatools-starter-web-flask",
        "Issues": "https://github.com/seatools-py/seatools-starter-web-flask/issues"
    },
    "split_keywords": [
        "seatools",
        " starter"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d3f5f5d228572c46bca160d8fdd362c4e51c94464fc83e481b348f1c920eaab6",
                "md5": "911b3121c6707727d01d29154096bb03",
                "sha256": "9ab4c7ee407afa27377b4b1069b330545646674feaeb17087adb39050b77d361"
            },
            "downloads": -1,
            "filename": "seatools_starter_web_flask-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "911b3121c6707727d01d29154096bb03",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 3928,
            "upload_time": "2024-12-26T10:10:46",
            "upload_time_iso_8601": "2024-12-26T10:10:46.466976Z",
            "url": "https://files.pythonhosted.org/packages/d3/f5/f5d228572c46bca160d8fdd362c4e51c94464fc83e481b348f1c920eaab6/seatools_starter_web_flask-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d70b51c03449b907ecf7e993f962baa35aea7f496f2fe76485ec3c3e6177c2c3",
                "md5": "485c8c6119f26d1976130e0fa876e6ca",
                "sha256": "988840575dec658bc0c5c9151ac9083bd55ac78b1bfe2f36e100f2d23176d795"
            },
            "downloads": -1,
            "filename": "seatools_starter_web_flask-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "485c8c6119f26d1976130e0fa876e6ca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 2838,
            "upload_time": "2024-12-26T10:10:48",
            "upload_time_iso_8601": "2024-12-26T10:10:48.678175Z",
            "url": "https://files.pythonhosted.org/packages/d7/0b/51c03449b907ecf7e993f962baa35aea7f496f2fe76485ec3c3e6177c2c3/seatools_starter_web_flask-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-26 10:10:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "seatools-py",
    "github_project": "seatools-starter-web-flask",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "seatools-starter-web-flask"
}
        
Elapsed time: 2.70276s