在没有任何Fram的Ubuntu上使用Gunicorn和Nginx

2024-05-08 22:28:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一段代码在ubuntu16.04中运行良好gunicorn -b :8080 web:Main

#!/usr/bin/python
# -*- Coding: UTF-8 -*-

def Main(env,start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    data = "<h1>It Works!</h1>"
    return data

现在我想将Nginx配置为使用Gunicorn为Python应用程序提供服务,我已经阅读了Docs,但是我不明白如何做到这一点(所以我不需要使用Gunicorn命令)

我也搜索了很多,但所有的结果都使用了Django、Flask和VirtualEnv。 我需要的是Ubuntu中的“pythonweb从头开发”。你知道吗

有没有可能在没有任何框架的情况下做到这一点,还是建议这样做?你知道吗


Tags: 代码envwebdatabinmainresponseusr