R
Railway9mo ago
Malay

Deployment Failed during build process

3 | >>> RUN python manage.py collectstatic 25 | CMD ["gunicorn", "core.wsgi:application"] ERROR: failed to solve: process "/bin/sh -c python manage.py collectstatic" did not complete successfully: exit code: 1 my staicfiles setings: STATIC_URL = '/static/' STATIC_ROOT = path.join(BASE_DIR, 'staticfiles') STATICFILES_DIRS = ( path.join(BASE_DIR, 'static'), )
Solution:
trying it out CMD python manage.py collectstatic --noinput && gunicorn core.wsgi:application
Jump to solution
23 Replies
Percy
Percy9mo ago
Project ID: 286dccfe-bf85-48fe-ae80-ab24c5a80716
Brody
Brody9mo ago
please use the bookmarklet
Malay
Malay9mo ago
Malay
Malay9mo ago
here is my folder struture
No description
Malay
Malay9mo ago
And the deployment was happening using the docker file. please let me know if I need to provide any other info
Brody
Brody9mo ago
try python manage.py collectstatic --noinput instead
Malay
Malay9mo ago
okay
Malay
Malay9mo ago
Brody
Brody9mo ago
File "/app/core/settings.py", line 180, in <module> 'SOCIAL_AUTH_ALLOWED_REDIRECT_URIS': getenv('REDIRECT_URLS').split(',')
AttributeError: 'NoneType' object has no attribute 'split'
File "/app/core/settings.py", line 180, in <module> 'SOCIAL_AUTH_ALLOWED_REDIRECT_URIS': getenv('REDIRECT_URLS').split(',')
AttributeError: 'NoneType' object has no attribute 'split'
do you have a REDIRECT_URLS variable set in your service?
Malay
Malay9mo ago
yes I have
Brody
Brody9mo ago
send your dockerfile
Malay
Malay9mo ago
No description
Malay
Malay9mo ago
if I comment out RUN python manage.py collectstatic --noinput the depolyment gets finished. But I get 400 error when I try to make request to the api endpoints
Brody
Brody9mo ago
you run collect static during build, that command executes the settings.py file, the settings.py file trys to read environment variables that you haven't defined in your dockerfile, to bring the railway service variables into the dockerfile you need to do ARG <variable name> after the FROM keyword or you could just run collect static in the CMD command since that's ran during runtime when all environment variables are injected automatically
Malay
Malay9mo ago
will this work? CMD gunicorn core.wsgi:application && python manage.py collectstatic --noinput
Brody
Brody9mo ago
collect static first otherwise yes that syntax is correct
Solution
Malay
Malay9mo ago
trying it out CMD python manage.py collectstatic --noinput && gunicorn core.wsgi:application
Malay
Malay9mo ago
Thanks man It worked
Brody
Brody9mo ago
awesome
Floris
Floris9mo ago
brody more like debugging king
Brody
Brody9mo ago
thanks for the train ❤️