New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GrahamDumpleton opened this Issue Jul 29, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@GrahamDumpleton

GrahamDumpleton commented Jul 29, 2016

Using:

$ 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/manage.py collectstatic

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

    /Users/graham/Testing/opal/mynewapp/mynewapp/assets

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/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/graham/.warpdrive/warpdrive+opal/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/Users/graham/.warpdrive/warpdrive+opal/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/graham/.warpdrive/warpdrive+opal/lib/python2.7/site-packages/django/core/management/base.py", 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/base.py", 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/collectstatic.py", line 168, in handle
    collected = self.collect()
  File "/Users/graham/.warpdrive/warpdrive+opal/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 "/Users/graham/.warpdrive/warpdrive+opal/lib/python2.7/site-packages/django/contrib/staticfiles/finders.py", 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/utils.py", line 28, in get_files
    directories, files = storage.listdir(location)
  File "/Users/graham/.warpdrive/warpdrive+opal/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: '/Users/graham/Testing/opal/mynewapp/mynewapp/static'

The opal startproject command should perhaps create the static directory.

@GrahamDumpleton

This comment has been minimized.

Show comment
Hide comment
@GrahamDumpleton

GrahamDumpleton Jul 29, 2016

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.

GrahamDumpleton commented Jul 29, 2016

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.

@davidmiller

This comment has been minimized.

Show comment
Hide comment
@davidmiller

davidmiller Jul 29, 2016

Member

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.

Member

davidmiller commented Jul 29, 2016

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 added a commit that referenced this issue Jul 29, 2016

Ensure that the target of STATIC_ROOT exists for freshly scaffolded
    apps.

    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

@davidmiller

This comment has been minimized.

Show comment
Hide comment
@davidmiller

davidmiller Jul 29, 2016

Member

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!

Member

davidmiller commented 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