Can't collectstatic

Asked by Peter Senna

Hi,

I'm trying to get started with graphite, and I did good progress as I can see graphite-web is running, but it is not showing the left menu with the tree, only the top links: Documentation, Dashboard, Events, Login

Looking at the logs, there are two kinds of errors:

Loads of: "/usr/lib/python2.7/site-packages/django/template/<file>.py:line: RemovedInDjango110Warning: You haven't defined a TEMPLATES setting. You must do so before upgrading to Django 1.10. Otherwise Django will be unable to load templates."

and missing files on /static such as:

"GET /static/js/ext/ext-all-debug.js HTTP/1.1" 404 1097

So I need to go and run collectstatic, right? But it does not work:

# PYTHONPATH=/usr/share/graphite/webapp django-admin collectstatic --settings=graphite.settings

You have requested to collect static files at the destination
location as specified in your settings:

    /usr/share/graphite/static

This will overwrite existing files!
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
  File "/usr/bin/django-admin", line 5, in <module>
    management.execute_from_command_line()
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 176, in handle
    collected = self.collect()
  File "/usr/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 98, in collect
    for path, storage in finder.list(self.ignore_patterns):
  File "/usr/lib/python2.7/site-packages/django/contrib/staticfiles/finders.py", line 112, in list
    for path in utils.get_files(storage, ignore_patterns):
  File "/usr/lib/python2.7/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
    directories, files = storage.listdir(location)
  File "/usr/lib/python2.7/site-packages/django/core/files/storage.py", line 299, in listdir
    for entry in os.listdir(path):
OSError: [Errno 2] No such file or directory: '/usr/lib/python2.7/site-packages/content'

I guess I may be missing something silly here. Ideas? I'm running on Fedora 25, installed from fedora packages:
graphite2-1.3.10-1.fc25.x86_64
graphite-web-0.10.0-0.1.rc1.fc25.noarch

Thanks a lot!

Question information

Language:
English Edit question
Status:
Solved
For:
Graphite Edit question
Assignee:
No assignee Edit question
Solved by:
Peter Senna
Solved:
Last query:
Last reply:
Revision history for this message
Denis Zhdanov (deniszhdanov) said :
#1

Check files in ` /usr/share/graphite/static`. If it's there - then you need to configure your webserver to serve /static files from this directory - as described in documentation - https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/modwsgi/#serving-files - "Alias /static/ /usr/share/graphite/static"

Revision history for this message
Peter Senna (peter-senna) said :
#2

Hi Dennis,

Thank you for the message. Unfortunately it did not help. I'm having issues calling the 'django-admin collectstatic', and my apache conf looks sort of sane, pasted it on the end of the email:

Any ideas of what I'm missing so 'django-admin collectstatic' will run?

Thanks a lot!

<VirtualHost *:80>
    ServerName graphite-web
    DocumentRoot "/usr/share/graphite/webapp"
    ErrorLog /var/log/httpd/graphite-web-error.log
    CustomLog /var/log/httpd/graphite-web-access.log common

    # Header set Access-Control-Allow-Origin "*"
    # Header set Access-Control-Allow-Methods "GET, OPTIONS"
    # Header set Access-Control-Allow-Headers "origin, authorization, accept"
    # Header set Access-Control-Allow-Credentials true

    WSGIScriptAlias / /usr/share/graphite/graphite-web.wsgi
    WSGIImportScript /usr/share/graphite/graphite-web.wsgi process-group=%{GLOBAL} application-group=%{GLOBAL}

    <Location "/content/">
        SetHandler None
    </Location>

    Alias /media/ "/usr/lib/python2.7/site-packages/django/contrib/admin/media/"
    <Location "/media/">
        SetHandler None
    </Location>

   <Directory "/usr/share/graphite/">
       <IfModule mod_authz_core.c>
           # Apache 2.4
           #Require local
           Require all granted
       </IfModule>
       <IfModule !mod_authz_core.c>
           # Apache 2.2
           Order Deny,Allow
           Deny from all
           Allow from 127.0.0.1
           Allow from ::1
       </IfModule>
   </Directory>
</VirtualHost>

Revision history for this message
Denis Zhdanov (deniszhdanov) said :
#3

Unfortunately, I do not know what's happened with your 'django-admin collectstatic', probably your Django installation is broken in someway.
Could you please show what's in your '/usr/share/graphite/static' reside?

Revision history for this message
Peter Senna (peter-senna) said :
#4

Just to complement, adding Alias /static/ "/usr/share/graphite/static" had no positive effect.

Revision history for this message
Peter Senna (peter-senna) said :
#5

Hi Dennis,

Thanks a lot for the support! My static folder is empty. See:
# pwd
/usr/share/graphite

# ls
graphite-web.wsgi static webapp

# ls static/

# ls webapp/
content

One thing I'm trying to solve is that pointing my browser to /static is giving me 404, but apache is not being kind enough to tell me where is it trying to get static from. Thanks again!

Revision history for this message
Peter Senna (peter-senna) said :
#6

So why doesn't the Install section of 'https://graphiteapp.org/' come with:

Try Graphite in Docker and have it running in seconds:

docker run -d\
 --name graphite\
 --restart=always\
 -p 80:80\
 -p 2003-2004:2003-2004\
 -p 2023-2024:2023-2024\
 -p 8125:8125/udp\
 -p 8126:8126\
 hopsoft/graphite-statsd

This is portable, fast and easy to use. Why not a single pointer to this from the official documentation?

Revision history for this message
Denis Zhdanov (deniszhdanov) said :
#7

Because we still have no official docker image. And @hopsoft's one is outdated.

Revision history for this message
Denis Zhdanov (deniszhdanov) said :
#8

I'm doing exactly this now (official docker image based on @hopsoft and synthesize) btw

Revision history for this message
Peter Senna (peter-senna) said :
#9

Official Docker images is great news Dennis! Really great stuff!

Revision history for this message
Denis Zhdanov (deniszhdanov) said :
#10
Revision history for this message
Peter Senna (peter-senna) said :
#11

Hi Denis,

I'm getting:

sudo docker pull graphiteapp/graphite-statsd
Using default tag: latest
Trying to pull repository docker.io/graphiteapp/graphite-statsd ...
manifest unknown: manifest unknown

Guess you need a tag named latest to fix this.

Cheers!

On Tue, Jul 18, 2017 at 9:14 PM, Denis Zhdanov
<email address hidden> wrote:
> Your question #649208 on Graphite changed:
> https://answers.launchpad.net/graphite/+question/649208
>
> Denis Zhdanov posted a new comment:
> Just pushed https://hub.docker.com/r/graphiteapp/graphite-statsd/
>
> Will add link to http://graphiteapp.org/quick-start-guides/
>
> --
> You received this question notification because you asked the question.

--
Peter

Revision history for this message
Denis Zhdanov (deniszhdanov) said :
#12

Ah, OK. Pushed latest, please try now.

Revision history for this message
Mariano (mobarrio) said :
#13

Hi Peter,
   I have the same problem to you describe in the 1st post, but when I put in DEBUG mode to TRUE all work fine, and if change it to FALSE hang again.

/opt/graphite/webapp/graphite/local_settings.py
DEBUG = True

DEBUG = False <---- HANG!!!

[root@TestSSOO01 bin]# /opt/graphite/bin/run-graphite-devel-server.py /opt/graphite/
Running Graphite from /opt/graphite/ under django development server

django-admin.py runserver --pythonpath /opt/graphite/webapp --settings graphite.settings 0.0.0.0:8080
Running Graphite from /opt/graphite/ under django development server

django-admin.py runserver --pythonpath /opt/graphite/webapp --settings graphite.settings 0.0.0.0:8080
Performing system checks...

System check identified no issues (0 silenced).
July 19, 2017 - 09:01:30
Django version 1.11.3, using settings 'graphite.settings'
Starting development server at http://0.0.0.0:8080/
Quit the server with CONTROL-C.
[19/Jul/2017 09:01:36] "GET / HTTP/1.1" 200 962
[19/Jul/2017 09:01:36] "GET /composer? HTTP/1.1" 200 4127
[19/Jul/2017 09:01:36] "GET /browserheader HTTP/1.1" 200 2944
[19/Jul/2017 09:01:37] "GET /static/js/ext/resources/css/ext-all.css HTTP/1.1" 404 113 <---- 404 Err
[19/Jul/2017 09:01:37] "GET /static/js/ext/adapter/ext/ext-base.js HTTP/1.1" 404 111 <---- 404 Err
[19/Jul/2017 09:01:37] "GET /static/js/browser.js HTTP/1.1" 404 94 <---- 404 Err
[19/Jul/2017 09:01:37] "GET /static/js/ext/ext-all.js HTTP/1.1" 404 98 <---- 404 Err
[19/Jul/2017 09:01:37] "GET /static/js/composer_widgets.js HTTP/1.1" 404 103 <---- 404 Err
[19/Jul/2017 09:01:37] "GET /static/js/completer.js HTTP/1.1" 404 96 <---- 404 Err
[19/Jul/2017 09:01:37] "GET /static/js/composer.js HTTP/1.1" 404 95 <---- 404 Err
[19/Jul/2017 09:01:38] "GET /static/img/graphite-logo.png HTTP/1.1" 404 102 <---- 404 Err
[19/Jul/2017 09:01:38] "GET /static/img/carbon-fiber.png HTTP/1.1" 404 101 <---- 404 Err
[19/Jul/2017 09:01:38] "GET /static/js/browser.js HTTP/1.1" 404 94 <---- 404 Err
[19/Jul/2017 09:01:38] "GET /static/js/composer_widgets.js HTTP/1.1" 404 103 <---- 404 Err
[19/Jul/2017 09:01:38] "GET /static/js/composer.js HTTP/1.1" 404 95 <---- 404 Err
[19/Jul/2017 09:01:38] "GET /static/js/completer.js HTTP/1.1" 404 96 <---- 404 Err

DEBUG = True

[root@TestSSOO01 bin]# /opt/graphite/bin/run-graphite-devel-server.py /opt/graphite/
Running Graphite from /opt/graphite/ under django development server

django-admin.py runserver --pythonpath /opt/graphite/webapp --settings graphite.settings 0.0.0.0:8080
Running Graphite from /opt/graphite/ under django development server

django-admin.py runserver --pythonpath /opt/graphite/webapp --settings graphite.settings 0.0.0.0:8080
Performing system checks...

System check identified no issues (0 silenced).
July 19, 2017 - 09:03:08
Django version 1.11.3, using settings 'graphite.settings'
Starting development server at http://0.0.0.0:8080/
Quit the server with CONTROL-C.
[19/Jul/2017 09:03:12] "GET / HTTP/1.1" 200 962
[19/Jul/2017 09:03:12] "GET /browserheader HTTP/1.1" 200 2944
[19/Jul/2017 09:03:12] "GET /composer? HTTP/1.1" 200 4139
[19/Jul/2017 09:03:12] "GET /static/js/ext/ext-all-debug.js HTTP/1.1" 304 0
[19/Jul/2017 09:03:12] "GET /static/js/ext/adapter/ext/ext-base-debug.js HTTP/1.1" 304 0
[19/Jul/2017 09:03:12] "GET /static/img/carbon-fiber.png HTTP/1.1" 200 4222
[19/Jul/2017 09:03:12] "GET /static/img/graphite-logo.png HTTP/1.1" 200 41411
[19/Jul/2017 09:03:12] "GET /static/js/completer.js HTTP/1.1" 200 1519
[19/Jul/2017 09:03:12] "GET /static/js/ext/resources/css/ext-all.css HTTP/1.1" 200 139591
[19/Jul/2017 09:03:12] "GET /static/js/browser.js HTTP/1.1" 200 7919
[19/Jul/2017 09:03:12] "GET /static/js/composer.js HTTP/1.1" 200 7745
[19/Jul/2017 09:03:12] "GET /static/js/composer_widgets.js HTTP/1.1" 200 53800
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/tabs/tabs-sprite.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/panel/tool-sprites.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/tabs/tab-strip-bg.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/tree/elbow-plus.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/tree/folder.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/tree/elbow-end-plus.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/layout/mini-left.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/window/left-corners.png HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/window/right-corners.png HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/toolbar/bg.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/window/left-right.png HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/window/top-bottom.png HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/button/btn.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/sizer/s-handle.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/sizer/se-handle.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/img/clock.png HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/sizer/sw-handle.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/sizer/e-handle.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/sizer/ne-handle.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/img/upload.png HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/img/calendar.png HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/img/share.png HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/img/refresh.png HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/grid/grid-blue-split.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/button/arrow.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/sizer/nw-handle.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/shadow-lr.png HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/shadow-c.png HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/shadow.png HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /static/js/ext/resources/images/default/s.gif HTTP/1.1" 304 0
[19/Jul/2017 09:03:13] "GET /render/?width=586&height=308&_salt=1500447793.347 HTTP/1.1" 200 2003

Brgds,

Mariano

Revision history for this message
Mariano (mobarrio) said :
#14

Hi again,
 if you change your httpd.conf

 <Directory />
     AllowOverride none
     Require all denied
 </Directory>

to this:

 <Directory />
     AllowOverride none
     Require all granted
 </Directory>

Now all working fine!

M.