Running python collectstatic will fail as static directory doesn't exist. #803

GrahamDumpleton opened this Issue Jul 29, 2016 · 3 comments


None yet

2 participants



$ opal --version
OPAL 0.7.0

if you create a new project, even if you run runserver, if you run collectstatic it will fail as the static directory referenced by STATICFILES_DIRS in the settings module doesn't exist.

$ python mynewapp/ collectstatic

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


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 "mynewapp/", line 10, in <module>
  File "/Users/graham/.warpdrive/warpdrive+opal/lib/python2.7/site-packages/django/core/management/", line 354, in execute_from_command_line
  File "/Users/graham/.warpdrive/warpdrive+opal/lib/python2.7/site-packages/django/core/management/", line 346, in execute
  File "/Users/graham/.warpdrive/warpdrive+opal/lib/python2.7/site-packages/django/core/management/", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/graham/.warpdrive/warpdrive+opal/lib/python2.7/site-packages/django/core/management/", line 445, in execute
    output = self.handle(*args, **options)
  File "/Users/graham/.warpdrive/warpdrive+opal/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/", line 168, in handle
    collected = self.collect()
  File "/Users/graham/.warpdrive/warpdrive+opal/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/", line 98, in collect
    for path, storage in finder.list(self.ignore_patterns):
  File "/Users/graham/.warpdrive/warpdrive+opal/lib/python2.7/site-packages/django/contrib/staticfiles/", line 112, in list
    for path in utils.get_files(storage, ignore_patterns):
  File "/Users/graham/.warpdrive/warpdrive+opal/lib/python2.7/site-packages/django/contrib/staticfiles/", line 28, in get_files
    directories, files = storage.listdir(location)
  File "/Users/graham/.warpdrive/warpdrive+opal/lib/python2.7/site-packages/django/core/files/", line 299, in listdir
    for entry in os.listdir(path):
OSError: [Errno 2] No such file or directory: '/Users/graham/Testing/opal/mynewapp/mynewapp/static'

The opal startproject command should perhaps create the static directory.


One potential problem with creating the directory is that if people then add the generated project code into a git repository, because it is an empty directory, it will not be added. One would need to create at least one file in the directory for git to add it to the repository.


Thanks @GrahamDumpleton - good shout!

Creating that directory with just for example a README that explains why it's there as part of that command might be a solution.

@davidmiller davidmiller added a commit that referenced this issue Jul 29, 2016
@davidmiller davidmiller Ensure that the target of STATIC_ROOT exists for freshly scaffolded

    Allow git add . to ensure the directory is created but doesn't add
    things we _know_ will exist there after running collectstatic.

    refs #803
@davidmiller davidmiller self-assigned this Jul 29, 2016

Hi @GrahamDumpleton - this issue should now be fixed - either on the v0.7.1 branch of a git checkout or via a direct github download.

Please do let us know if you find any other issues - we're always keen to have feedback & / or know about bugs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment