用于python的ddd nginx框架

ddd-nginx的Python项目详细描述


ddd nginx框架

Build StatusPypi StatusCoveralls Status

安装

源代码:

python setup.py install

来自PYPI:

pip install ddd-base

使用量

from ddd_nginx.nginx import Nginx
from ddd_nginx.map import Map, MapKeyParis, MapDefinition
from ddd_nginx.server import Server
from ddd_nginx.location import Location, ReverseProxyStrategy
from ddd_nginx.upstream import Upstream


nginx = Nginx(host="oneapi.cc")
nginx.namespace = "api"

a_map = Map(MapDefinition(key="$http_apikey", value="$api_client_name"))
a_map.append(MapKeyParis("7B5zIqmRGXmrJTFmKa99vcit", "client_one"))
a_map.append(MapKeyParis("QzVV6y1EmQFbbxOfRCwyJs35", "client_two"))
a_map.append(MapKeyParis("mGcjH8Fv6U9y3BVF9H3Ypb9T", "client_six"))

a_upstream = Upstream(name="warehouse_inventory")
a_upstream.append("10.0.0.1:80")
a_upstream.append("10.0.0.2:80")
a_upstream.append("10.0.0.3:80")

b_upstream = Upstream(name="warehouse_pricing")
b_upstream.append("10.0.0.1:80")
b_upstream.append("10.0.0.2:80")
b_upstream.append("10.0.0.3:80")

a_location = Location(
    name="/api/warehouse/inventory",
    proxy=ReverseProxyStrategy('rewrite', '^ /_warehouse last')
)
a_location.set_var("$upstream", "warehouse_inventory")
b_location = Location(
    name="/api/warehouse/pricing",
    proxy=ReverseProxyStrategy('rewrite', '^ /_warehouse last')
)
b_location.set_var("$upstream", "warehouse_pricing")
c_location = Location(
    name="= /_warehouse",
    proxy=ReverseProxyStrategy('proxy_pass', 'http://$upstream$request_uri'),
    scope="internal"
)
c_location.set_var("$api_name", "Warehouse")

a_server = Server(name=nginx.namespace)
a_server.set_var("$api_name", "-")

nginx.append(a_map)
nginx.append(a_upstream)
nginx.append(b_upstream)
nginx.append(a_location)
nginx.append(b_location)
nginx.append(c_location)
nginx.append(a_server)

root_dir = "./dumps_dir"
nginx.dumps(root_dir)

许可证

本软件在MIT license

License file

变更日志

0.0.8

  • 包括模板文件

0.0.7

  • 包括Jinja2模板

0.0.6

  • 添加JSON错误页配置文件

0.0.5

  • 增加覆盖范围

0.0.4

  • 清除相关性

0.0.3

  • 将nginx转储到文件

0.0.2

  • 使用模板渲染conf

0.0.1

  • 首次公开发行

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
在Java中使用Kotlin值类   在Hadoop中表示大文本块作为键的java   java安卓工作室;布局设计视图;   字典Java确定字符串是否以映射中的键开头   JavaG1:混合gc和完全gc之间有什么区别?   java Camunda升级组织。阿帕奇。平民语言错误   java Scanner类具有NextLine无限循环   安卓 GCM Java服务器:发送带有重音字符的消息   java我正在构建一个兴趣计算应用程序,我的项目构建良好,有1个警告,但它不会在我的设备上打开   java在Tilera TileGX上构建OpenJDK 8   GUI中的java惰性初始化与急切初始化   java JodaTime四舍五入到最近的一刻钟   java如何限制菜单。SpringRoo中的jspx可以避免对其他用户的实体执行CRUD操作   java我应该将缓冲流链接到输入流,还是在将声音库作为嵌入式资源加载时使用URL类?