django1.8 collectstatic permission denied

3,349 views
Skip to first unread message

sudhin babu

unread,
May 27, 2015, 2:28:12 PM5/27/15
to django...@googlegroups.com
i am using ubntu14.04  copying admin static files to STATC_ROOT  may solve this problem but how  can i run this command successfully?

(hackernews)junkuos@ hackernews$ ./manage.py collectstatic

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

    /static

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

Type 'yes' to continue, or 'no' to cancel: yes
Copying '/home/sudhin/django/hackernews/static/css/main.css'
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/sudhin/.virtualenvs/hackernews/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/home/sudhin/.virtualenvs/hackernews/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/sudhin/.virtualenvs/hackernews/local/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/sudhin/.virtualenvs/hackernews/local/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
    output = self.handle(*args, **options)
  File "/home/sudhin/.virtualenvs/hackernews/local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle
    collected = self.collect()
  File "/home/sudhin/.virtualenvs/hackernews/local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 107, in collect
    handler(path, prefixed_path, storage)
  File "/home/sudhin/.virtualenvs/hackernews/local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 315, in copy_file
    self.storage.save(prefixed_path, source_file)
  File "/home/sudhin/.virtualenvs/hackernews/local/lib/python2.7/site-packages/django/core/files/storage.py", line 64, in save
    name = self._save(name, content)
  File "/home/sudhin/.virtualenvs/hackernews/local/lib/python2.7/site-packages/django/core/files/storage.py", line 223, in _save
    os.makedirs(directory)
  File "/home/sudhin/.virtualenvs/hackernews/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/home/sudhin/.virtualenvs/hackernews/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/static'

Tim Graham

unread,
May 27, 2015, 3:59:38 PM5/27/15
to django...@googlegroups.com
STATIC_ROOT should be the absolute path to the directory static files should be collected to. Example: "/var/www/example.com/static/"

It looks like you set it to "/static" which probably doesn't exist (or at least your user doesn't have write privileges to it).
Reply all
Reply to author
Forward
0 new messages