title: Running collectstatic on server : AttributeError: 'PosixPath' object has no attribute 'startswith'
body: <p>After deploying on a server on digital ocean using nginx, gunicorn, django, and virtualenv, I try to use collectstatic:</p>
  
  <pre><code>python manage.py collectstatic --settings=config.settings.production
  </code></pre>
  
  <p>As you can see I have multiple setting files. One base, one local and one production setting file. Below is the error:</p>
  
  <pre><code>    Traceback (most recent call last):
    File "manage.py", line 22, in &lt;module&gt;
      execute_from_command_line(sys.argv)
    File "/home/tony/vp/vpenv/lib/python3.5/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
      utility.execute()
    File "/home/tony/vp/vpenv/lib/python3.5/site-packages/django/core/management/__init__.py", line 355, in execute
      self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/home/tony/vp/vpenv/lib/python3.5/site-packages/django/core/management/base.py", line 283, in run_from_argv
      self.execute(*args, **cmd_options)
    File "/home/tony/vp/vpenv/lib/python3.5/site-packages/django/core/management/base.py", line 330, in execute
      output = self.handle(*args, **options)
    File "/home/tony/vp/vpenv/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 173, in handle
      if self.is_local_storage() and self.storage.location:
    File "/home/tony/vp/vpenv/lib/python3.5/site-packages/django/utils/functional.py", line 239, in inner
      return func(self._wrapped, *args)
    File "/home/tony/vp/vpenv/lib/python3.5/site-packages/django/utils/functional.py", line 35, in __get__
      res = instance.__dict__[self.name] = self.func(instance)
    File "/home/tony/vp/vpenv/lib/python3.5/site-packages/django/core/files/storage.py", line 283, in location
      return abspathu(self.base_location)
    File "/home/tony/vp/vpenv/lib/python3.5/posixpath.py", line 357, in abspath
      if not isabs(path):
    File "/home/tony/vp/vpenv/lib/python3.5/posixpath.py", line 64, in isabs
      return s.startswith(sep)
  AttributeError: 'PosixPath' object has no attribute 'startswith'
  </code></pre>
  
  <p>my <code>production.py</code> settings file contains the following:</p>
  
  <pre><code>MEDIA_ROOT = BASE_DIR / 'media'
  MEDIA_URL = 'media/'
  STATIC_ROOT = BASE_DIR / 'static'
  </code></pre>
  
  <p>my base dir is as follows (imported from the base setting file):</p>
  
  <pre><code>BASE_DIR = Path(__file__).resolve().parent.parent.parent
  </code></pre>
  
  <p>What could be the cause?</p>