title: Django OSError: [Errno 13] Permission denied
body: <p>I am new in python and Linux and apologize in advance for any confusion.
  I am trying to collect my static files using</p>
  <pre><code>python manage.py collectstatic
  </code></pre>
  <p>but something error here are my tracebacks</p>
  <pre><code>&gt; Copying '/var/www/Django/myweb/static/images/test.jpg'
  Traceback (most recent call last):
    File &quot;manage.py&quot;, line 22, in &lt;module&gt;
      execute_from_command_line(sys.argv)
    File &quot;/home/test01/Django/VENV/local/lib/python2.7/site-packages/django/core/management/__init__.py&quot;, line 363, in execute_from_command_line
      utility.execute()
    File &quot;/home/test01/Django/VENV/local/lib/python2.7/site-packages/django/core/management/__init__.py&quot;, line 355, in execute
      self.fetch_command(subcommand).run_from_argv(self.argv)
    File &quot;/home/test01/Django/VENV/local/lib/python2.7/site-packages/django/core/management/base.py&quot;, line 283, in run_from_argv
      self.execute(*args, **cmd_options)
    File &quot;/home/test01/Django/VENV/local/lib/python2.7/site-packages/django/core/management/base.py&quot;, line 330, in execute
      output = self.handle(*args, **options)
    File &quot;/home/test01/Django/VENV/local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py&quot;, line 199, in handle
      collected = self.collect()
    File &quot;/home/test01/Django/VENV/local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py&quot;, line 124, in collect
      handler(path, prefixed_path, storage)
    File &quot;/home/test01/Django/VENV/local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py&quot;, line 364, in copy_file
      self.storage.save(prefixed_path, source_file)
    File &quot;/home/test01/Django/VENV/local/lib/python2.7/site-packages/django/core/files/storage.py&quot;, line 54, in save
      return self._save(name, content)
    File &quot;/home/test01/Django/VENV/local/lib/python2.7/site-packages/django/core/files/storage.py&quot;, line 321, in _save
      os.makedirs(directory)
    File &quot;/home/test01/Django/VENV/lib/python2.7/os.py&quot;, line 157, in makedirs
      mkdir(name, mode)
  OSError: [Errno 13] Permission denied: '/var/www/staticfiles/images'
  </code></pre>
  <p>and I also try <code>sudo python manage.py collectstatic</code></p>
  <pre><code>&gt;File &quot;manage.py&quot;, line 17, in &lt;module&gt;
      &quot;Couldn't import Django. Are you sure it's installed and &quot;
  ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
  </code></pre>
  <p>and here is my setting.py</p>
  <pre><code>STATIC_URL = '/static/'
  STATICFILES_DIRS = [
      os.path.join(BASE_DIR, 'static'),
  ] 
  STATIC_ROOT = '/var/www/staticfiles'
  </code></pre>