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