DEV Community

Discussion on: Creating an app with Docker Compose, Django, and Create React App

Collapse
 
xor0831 profile image
Daniel Soriano

Heroku fails with this error

Step 15/17 : RUN DJANGO_SETTINGS_MODULE=hello_world.settings.production SECRET_KEY=somethingsupersecret python3 backend/manage.py collectstatic --noinput
---> Running in b36173638829
Traceback (most recent call last):
File "backend/manage.py", line 22, in
main()
File "backend/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 401, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 194, in handle
collected = self.collect()
File "/usr/local/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 109, in collect
for path, storage in finder.list(self.ignore_patterns):
File "/usr/local/lib/python3.8/site-packages/django/contrib/staticfiles/finders.py", line 130, in list
for path in utils.get_files(storage, ignore_patterns):
File "/usr/local/lib/python3.8/site-packages/django/contrib/staticfiles/utils.py", line 23, in get_files
directories, files = storage.listdir(location)
File "/usr/local/lib/python3.8/site-packages/django/core/files/storage.py", line 316, in listdir
for entry in os.scandir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/app/backend/frontend/build/static'
The command '/bin/sh -c DJANGO_SETTINGS_MODULE=hello_world.settings.production SECRET_KEY=somethingsupersecret python3 backend/manage.py collectstatic --noinput' returned a non-zero code: 1

Collapse
 
englishcraig profile image
Craig Franklin

That error is due to the frontend files not being in the expected folder after running yarn build. I wasn't able to recreate that specific error, but I was unable to deploy to Heroku due to some mysterious error while trying to install Yarn in the Dockerfile. I've updated dependencies in master and have since been able to build and deploy the app without problem. Trying pulling master and redeploying.