首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gunicorn配置文件在哪里?

问Gunicorn配置文件在哪里?
EN

Stack Overflow用户
提问于 2012-08-22 05:39:42
回答 5查看 58.5K关注 0票数 48

gunicorn文档中提到了编辑配置文件,但我不知道它在哪里。

答案可能很简单:)我在Amazon Linux AMI上。

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2012-11-12 17:03:17

答案就在gunicorn的文档中。http://docs.gunicorn.org/en/latest/configure.html

您可以使用.ini或python脚本指定配置文件。

例如,来自django-skel项目

代码语言:javascript
复制
"""gunicorn WSGI server configuration."""
from multiprocessing import cpu_count
from os import environ


def max_workers():    
    return cpu_count()


bind = '0.0.0.0:' + environ.get('PORT', '8000')
max_requests = 1000
worker_class = 'gevent'
workers = max_workers()

并且您可以使用以下命令运行服务器

代码语言:javascript
复制
gunicorn -c gunicorn.py.ini project.wsgi

请注意,project.wsgi对应于您的wsgi的位置。

票数 44
EN

Stack Overflow用户

发布于 2017-03-23 19:59:22

这里有一个示例文件:https://github.com/benoitc/gunicorn/blob/master/examples/example_config.py

你可以注释掉你不需要的东西,然后像这样指向Gunicorn:

代码语言:javascript
复制
gunicorn -c config.py myproject:app
票数 21
EN

Stack Overflow用户

发布于 2018-11-23 21:49:06

就默认名称而言,Gunicorn将查找名为gunicorn.conf.py in the directory where Gunicorn is executed的配置文件

票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12063463

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档