【问题标题】:Graphite browser is blank石墨浏览器是空白的
【发布时间】:2015-09-01 15:17:43
【问题描述】:

我是 Graphite 实时监控工具的新手。

我已经安装了所有的石墨组件(webapp、carbon、whisper) 当我启动石墨网络应用程序时 -

PYTHONPATH=`pwd`/whisper ./bin/run-graphite-devel-server.py --libs=`pwd`/webapp/ /opt/graphite/

并尝试访问浏览器我得到一个空白页

日志显示:

which: no django-admin in (/opt/grinder/java/jdk1.7.0_67/bin:/home/loadtester/bin:/usr/local/pgsql/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin)
Adding /opt/graphite/webapp/ to your PYTHONPATH
Running Graphite from /opt/graphite/ under django development server

/usr/bin/django-admin.py runserver --pythonpath /opt/graphite/webapp --settings graphite.settings 0.0.0.0:8080
/opt/graphite/webapp/graphite/settings.py:234: UserWarning: SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security
  warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security')
/opt/graphite/webapp/graphite/settings.py:234: UserWarning: SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security
  warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security')
Validating models...

0 errors found
Django version 1.4.21, using settings 'graphite.settings'
Development server is running at http://0.0.0.0:8080/
Quit the server with CONTROL-C.
[

    01/Sep/2015 10:41:01] "GET / HTTP/1.1" 200 599
    [01/Sep/2015 10:41:02] "GET /browserheader HTTP/1.1" 200 1091
    [01/Sep/2015 10:41:02] "GET /composer? HTTP/1.1" 200 1651
    [01/Sep/2015 10:41:02] "GET /content/js/ext/resources/css/ext-all.css HTTP/1.1" 500 632
    [01/Sep/2015 10:41:02] "GET /content/js/ext/adapter/ext/ext-base.js HTTP/1.1" 500 632
    [01/Sep/2015 10:41:02] "GET /content/js/ext/ext-all.js HTTP/1.1" 500 632
    [01/Sep/2015 10:41:02] "GET /content/js/browser.js HTTP/1.1" 500 632
    [01/Sep/2015 10:41:02] "GET /content/js/composer.js HTTP/1.1" 500 632
    [01/Sep/2015 10:41:02] "GET /content/js/composer_widgets.js HTTP/1.1" 500 632
    [01/Sep/2015 10:41:02] "GET /content/js/completer.js HTTP/1.1" 500 632
    [01/Sep/2015 10:41:02] "GET /content/img/carbon-fiber.png HTTP/1.1" 500 632

我错过了什么?看起来静态内容没有加载。

【问题讨论】:

  • 带着同样的问题来到这里。 7个月后没有反应! :(

标签: django graphite


【解决方案1】:

tldr;

整理Django静态文件管理最好的办法就是安装whitenoise,让它为你管理。

# pip install whitenoise

更多信息;

根据您的要求,有多种获取静态文件的方法。在大多数情况下,Whitenoise 仍然是建议,但是...

在开发环境中,建议的简单方法是在 local_settings.py 中设置 DEBUG=True,但不建议在生产服务器上这样做,或者当您有另一个进程服务于同一端口时,即 apache 等.

如果你有一个正在运行的服务器,即 apache,你可以通过为静态文件创建一个文件夹,并运行 django-admin 将静态文件收集到文件夹中来获取静态文件,因为它们将由内部提供进程。

# cd /opt/graphite/webapp
# mkdir ../static
# export PYTHONPATH=.
# export DJANGO_SETTINGS_MODULE=graphite.settings
# django-admin collectstatic

您的配置文件需要将 /static/ urls 别名为您创建的静态文件夹,并授予访问权限。例如,在 apache-graphite.conf 中,添加:

Alias /static/ /opt/graphite/static
<Location "/static/">
SetHandler None
Require all granted
</Location>

【讨论】:

    【解决方案2】:

    我遇到了同样的问题,经过大量谷歌搜索后,我将DEBUG = True 更改为webapp/graphite/local_settings.py,最后所有资源都已加载!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-20
      相关资源
      最近更新 更多