Skip to main content

Seatools gunicorn server starter.

Project description

seatools gunicorn 服务器启动器

该框架在gunicorn层完成seatools.ioc的加载, 使用该项目后无需在每个进程额外执行seatools.ioc.run函数, 仅在启动时传递一个ioc启动的函数即可

使用指南

  1. 安装, poetry add seatools-starter-server-gunicorn
  2. 这里以fastapi为例, 假设xxx.boot模块存在start的自定义启动ioc函数
from seatools.ioc import run


def start():
    run(scan_package_names='xxx', config_dir='./config')

命令行启动gunicorn xxx.boot:start xxx.fastapi.app:app, 其他参数与官方gunicorn一致, 在gunicorn基础上增加了一个ioc_app的参数, 需要指明ioc应用启动的函数 若配置application.ymlapplication-[*].yml中存在seatools.server.gunicorn.app配置, 则可不传递gunicornapp仅传递ioc_app即可, 示例gunicorn xxx.boot:start 若同时使用了seatools-starter-web-*web启动包, 则gunicornapp直接可省略 4. 支持配置config/application.yml

seatools:
  server:
    gunicorn:
      # 配置该参数后启动参数可忽略app参数, 配置与官方gunicorn.app.wsgiapp.run一致, 若安装 seatools-starter-web-* 可省略app配置 
      app: xxx.fastapi.app:app
      bind: ':8000'
      workers: 2
      worker_class: gevent
      ...
    

Project details


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

File details

Details for the file seatools_starter_server_gunicorn-1.0.0.tar.gz.

File metadata

File hashes

Hashes for seatools_starter_server_gunicorn-1.0.0.tar.gz
Algorithm Hash digest
SHA256 21437f72f346d474aff710692cdaf5255ad4847c31858262c348c47192a14426
MD5 e232c435b42d86a1bb84f6e56398a8fd
BLAKE2b-256 7f933020331a9a90f212e96bbb8043dfbe7f074f80820a026ca221a5cc83f661

See more details on using hashes here.

File details

Details for the file seatools_starter_server_gunicorn-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for seatools_starter_server_gunicorn-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0835deeec3421436cf2cc0c3af74a2bfd1572aa960b288d8eb790f2890f3945
MD5 b70d884fd198c13483231404f8de9a37
BLAKE2b-256 cc8ffd10d1c9b8478cd2cfd68c00058c8dafef4db83b77849365d3d471c0a0fc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page