我是Graphite实时监控工具的新手。
我已经安装了所有石墨组件(webapp,碳,耳语) 当我启动石墨webapp时 -
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
我错过了什么?看起来没有加载静态内容。
答案 0 :(得分: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>
答案 1 :(得分:0)
我遇到了同样的问题,经过大量的谷歌搜索,我在DEBUG = True
中更改了webapp/graphite/local_settings.py
,最后加载了所有资源!