8 months ago
I deployed my Django app from Github and it was working fine. But suddenly it started giving me this error in deploy logs
"/opt/venv/lib/python3.13/site-packages/django/core/handlers/base.py:61: UserWarning: No directory at: /app/productionfiles/ mw_instance = middleware(adapted_handler)"
productionfiles is the directory where i am collecting my staticfiles. I have whitenoise in requirements.txt, have it in settings.py as well. I have properly put a command to collectstatic files in my procfile as well.
PROCFILE: "web: python manage.py migrate && python manage.py collectstatic --no-input && gunicorn onestopshop_ecom.wsgi"
SETTINGS.PY:
"
STATIC_ROOT = BASE_DIR / 'productionfiles' STATIC_URL = 'static/' STATICFILES_DIRS = ['static/'] # Apply compression and caching of static files for better performance. Controls where static files are stored and served from. STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
"
I even tried to collect static files and push them to my github repo (earlier I had it in .gitignore and before my app was working fine. After it started giving error, I tried to push it to github, hoping that productionfiles/ directory exists) and now i don't see the error "No directory at ..." but still on browser when i visit my URL, i see this
"
This site can’t be reached Check if there is a typo in <project_name>-production.up.railway.app. DNS_PROBE_FINISHED_NXDOMAIN
"
I even tried to delete the service and create a new service and yet the errors are same.
Please help me fix this.
5 Replies
8 months ago
Hey there, could you please check the DNS settings for the domain to ensure they are correctly configured and verify that the domain is properly set up in Railway's public networking settings + the DNS records are correctly pointing to Railway's servers?
I'd also highly recommend looking at our Django guide https://docs.railway.com/guides/django
Status changed to Awaiting User Response Railway • 8 months ago
chandrika
Hey there, could you please check the DNS settings for the domain to ensure they are correctly configured and verify that the domain is properly set up in Railway's public networking settings + the DNS records are correctly pointing to Railway's servers?I'd also highly recommend looking at our Django guide https://docs.railway.com/guides/django
8 months ago
Thanks I will go through this. Btw can you please help me understand why i am getting this error that the directory doesn't exist. (attached deploy logs)
"[2025-03-28 18:40:35 +0000] [1] [INFO] Starting gunicorn 23.0.0
[2025-03-28 18:40:35 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2025-03-28 18:40:35 +0000] [1] [INFO] Using worker: sync
[2025-03-28 18:40:35 +0000] [6] [INFO] Booting worker with pid: 6
/opt/venv/lib/python3.13/site-packages/django/core/handlers/base.py:61: UserWarning: No directory at: /app/productionfiles/
mw_instance = middleware(adapted_handler)"
I don't want to push my static files folder to github and i rather prefer that collectstatic command runs always before running gunicorn server. If it was an error from my end I tried putting this in my procfile to make sure the directory exists.
web: mkdir -p productionfiles && python manage.py migrate && python manage.py collectstatic --no-input && gunicorn onestopshop_ecom.wsgi
but i am still getting the same error. It is really troubling me to be not able to find a solution to this. I would really appreciate your help on this.
Thanks
Status changed to Awaiting Railway Response Railway • 8 months ago
chandrika
Hey there, could you please check the DNS settings for the domain to ensure they are correctly configured and verify that the domain is properly set up in Railway's public networking settings + the DNS records are correctly pointing to Railway's servers?I'd also highly recommend looking at our Django guide https://docs.railway.com/guides/django
8 months ago
Hey, I went through the docs and I was doing everything correctly. The only thing that was different was i was using a different name for my STATIC_ROOT previously i was using STATIC_ROOT as productionfiles and the doc uses staticfiles/ but i don't think that should be any issue.
Also the doc you shared doesn't talk about "procfile".
8 months ago
Hmm, this feels like an application level issue that we are unable to help with due to the volume of questions we get but I can give a few more pointers and leave this open to the community.
I think the static files might not be collected correctly during the deployment process because that error points to the directory specified as STATIC_ROOT not existing when Django tries to serve static files. You could try ensure that your collectstatic command is successfully creating and populating that directory and the directory path in STATIC_ROOT aligns with what you're using in your code + check the permissions to make sure they are set correctly for file creation.
Status changed to Awaiting User Response Railway • 8 months ago
8 months ago
Yea but It was working before and I did not make any changes either. Surprisingly It stopped working for no reason. Also like I mentioned I tried to push static_root folder to github and yet it was not working.
Status changed to Awaiting Railway Response Railway • 8 months ago