0

I'm beginning to fear I'll never get my site launched.

I've launched an app on heroku, but I can't run heroku run python manage.py collectstatic without getting an OSError:

Traceback:

Running python manage.py collectstatic on ⬢ tallymusic... up, run.1934 (Free)
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 199, in handle
    collected = self.collect()
  File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 115, in collect
    for path, storage in finder.list(self.ignore_patterns):
  File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/finders.py", line 112, in list
    for path in utils.get_files(storage, ignore_patterns):
  File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
    directories, files = storage.listdir(location)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/files/storage.py", line 397, in listdir
    for entry in os.listdir(path):
OSError: [Errno 2] No such file or directory: '/app/tallymusicsite/assets'

Here's my settings.py static settings:

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_ROOT = os.path.join(BASE_DIR, 'assets')
STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'tallymusic/assets'),
    os.path.join(BASE_DIR, 'tallymusic/assets/css'),
    os.path.join(BASE_DIR, 'tallymusic/assets/images'),
    os.path.join(BASE_DIR, 'tallymusic/assets/js'),
    os.path.join(BASE_DIR, 'tallymusic/assets/venue_images')
)

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

I'm pretty confident the error comes from my STATICFILES_DIRS setting, but I can't figure it out. I've read so many answers on this error on StackOverflow, and tried every permutation suggested, including:

'../tallymusic/assets'
'../tallymusicsite/assets'
'app/tallymusic/assets'
'app/tallymusicsite/assets'
'tallymusic/tallymusicsite/assets'

etc. etc. etc.

I don't even really know what project name I should be using. My outer folder has always been called tallymusic but the folder holding the settings.py file is called tallymusicsite. Does that make tallymusicsite the project name?

Obviously I don't understand something basic. The Django documentation on static files isn't helping either. I can't even describe how much I would appreciate some help with this. Please let me know if I should have provided more information.

Edited to add:

Here's my file structure:

tallymusic
-- manage.py
--> apps, etc.
...
--> assets # actually has the files
--> tallymusicsite
---- settings.py
----> assets # read on a SO post that this is where I want the folder?
...

Let me know if you need more of the file structure.

4

0 回答 0