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:Jump to solution
trying it out
CMD python manage.py collectstatic --noinput && gunicorn core.wsgi:application
23 Replies
Project ID:
286dccfe-bf85-48fe-ae80-ab24c5a80716
full build logs please https://bookmarklets.up.railway.app/log-downloader/
please use the bookmarklet
here you go
here is my folder struture
And the deployment was happening using the docker file.
please let me know if I need to provide any other info
try
python manage.py collectstatic --noinput
insteadokay
still failing
do you have a
REDIRECT_URLS
variable set in your service?yes I have
send your dockerfile
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 endpointsyou 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 automaticallywill this work?
CMD gunicorn core.wsgi:application && python manage.py collectstatic --noinput
collect static first
otherwise yes that syntax is correct
Solution
trying it out
CMD python manage.py collectstatic --noinput && gunicorn core.wsgi:application
Thanks man
It worked
awesome
brody more like debugging king
thanks for the train ❤️