R
Railway14mo 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
Percy14mo ago
Project ID: 286dccfe-bf85-48fe-ae80-ab24c5a80716
Malay
Malay14mo ago
Brody
Brody14mo ago
please use the bookmarklet
Malay
Malay14mo ago
Malay
Malay14mo ago
here is my folder struture
No description
Malay
Malay14mo ago
And the deployment was happening using the docker file. please let me know if I need to provide any other info
Brody
Brody14mo ago
try python manage.py collectstatic --noinput instead
Malay
Malay14mo ago
okay
Malay
Malay14mo ago
Brody
Brody14mo 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
Malay14mo ago
yes I have
Brody
Brody14mo ago
send your dockerfile
Malay
Malay14mo ago
No description
Malay
Malay14mo 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
Brody14mo 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
Malay14mo ago
will this work? CMD gunicorn core.wsgi:application && python manage.py collectstatic --noinput
Brody
Brody14mo ago
collect static first otherwise yes that syntax is correct
Solution
Malay
Malay14mo ago
trying it out CMD python manage.py collectstatic --noinput && gunicorn core.wsgi:application
Malay
Malay14mo ago
Thanks man It worked
Brody
Brody14mo ago
awesome
Floris
Floris14mo ago
brody more like debugging king
Brody
Brody14mo ago
thanks for the train ❤️
Want results from more Discord servers?
Add your server