s2i-python-container: WARNING: could not run 'manage.py collectstatic' ??

Using 3.8, we have an issue with the step to collect the statics, deployed on OpenShift. The build gives this warning: ---> Collecting Django static files ... WARNING: could not run 'manage.py collectstatic'. To debug, run: $ python ./manage.py collectstatic --noinput Ignore this warning if you're not serving static files with Django.

Doing a manual python manage.py collectstatic --noinput works fine, it creates the staticfiles/ out of the /static as configured in the settings.py. I’ve created a copy of the assembly script to test the part, but also then it al seems to work fine. The working dir must be ok, since it can find the ./manage.py file.

All ideas or suggestions how to tackle this issue are welcome

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

Thank you for your patience. I’ve also learned something new today.

os.environ is a mapping like a dictionary so when a key is not there, a call to get method returns None. This is not a problem.

The problem is in Django and a quick googling uncovers that it’s a common problem for all container applications (for example Heroku). The accepted solution on stack overflow suggest basically what you invented yourself. It seems that collectstatic needs the secret key but does not use it so it can be set to some default value during a build.