gpt4 book ai didi

python - Graphite 和 GUnicorn - 配置问题或路径问题

转载 作者:太空狗 更新时间:2023-10-29 22:30:34 25 4
gpt4 key购买 nike

我一直在尝试让 Graphite 通过 GUnicorn 运行(最终通过 nginx 代理),但是我已经尝试了几乎所有启动应用程序的方法,但无法解决类似于以下的错误。

(graphite)/opt/graphite/conf gunicorn --bind=127.0.0.1:8080 graphite.wsgi:app
2014-03-03 17:02:14 [312] [INFO] Starting gunicorn 18.0
2014-03-03 17:02:14 [312] [INFO] Listening at: http://127.0.0.1:8080 (312)
2014-03-03 17:02:14 [312] [INFO] Using worker: sync
2014-03-03 17:02:14 [317] [INFO] Booting worker with pid: 317
2014-03-03 17:02:14 [317] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/opt/graphite/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
worker.init_process()
File "/opt/graphite/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
self.wsgi = self.app.wsgi()
File "/opt/graphite/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
self.callable = self.load()
File "/opt/graphite/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
return self.load_wsgiapp()
File "/opt/graphite/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
return util.import_app(self.app_uri)
File "/opt/graphite/local/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
__import__(module)
ImportError: No module named graphite.wsgi
Traceback (most recent call last):
File "/opt/graphite/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
worker.init_process()
File "/opt/graphite/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
self.wsgi = self.app.wsgi()
File "/opt/graphite/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
self.callable = self.load()
File "/opt/graphite/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
return self.load_wsgiapp()
File "/opt/graphite/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
return util.import_app(self.app_uri)
File "/opt/graphite/local/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
__import__(module)
ImportError: No module named graphite.wsgi
2014-03-03 17:02:14 [317] [INFO] Worker exiting (pid: 317)
2014-03-03 17:02:14 [312] [INFO] Shutting down: Master
2014-03-03 17:02:14 [312] [INFO] Reason: Worker failed to boot.

我试过在不同的目录(root 目录、conf 目录、webapp 目录等)中运行。我试过使用 gunicorn_django 助手运行。我可以使用开发服务器启动它:opt/graphite/bin/run-graphite-devel-server.py --port=8080/opt/graphite

我已经通过 virtualenv 和 pip 安装了所有东西,并简单地将 graphite.wsgi.example 文件复制到 conf 目录中的 graphite.wsgi。看起来像这样:

(graphite)/opt/graphite/conf cat graphite.wsgi.example
import os, sys
sys.path.append('/opt/graphite/webapp')
os.environ['DJANGO_SETTINGS_MODULE'] = 'graphite.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

# READ THIS
# Initializing the search index can be very expensive, please include
# the WSGIImportScript directive pointing to this script in your vhost
# config to ensure the index is preloaded before any requests are handed
# to the process.
from graphite.logger import log
log.info("graphite.wsgi - pid %d - reloading search index" % os.getpid())
import graphite.metrics.search
(graphite)/opt/graphite/conf

如有任何帮助,我们将不胜感激。

最佳答案

这无疑是错误的做法,但我遇到了同样的问题,我通过以下方式解决了这个问题:

mv /opt/graphite/conf/graphite.wsgi.example /opt/graphite/webapp/graphite/graphite_wsgi.py
cd /opt/graphite/webapp/graphite
gunicorn graphite_wsgi:application

您的问题可能只是使用“app”而不是变量“application”,所以请先简短说明一下。

祝你好运!

关于python - Graphite 和 GUnicorn - 配置问题或路径问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22158635/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com