Alright guys, at the end of this article I hope you should be able to deploy your first Django project on Railway app.
Railway app is a cloud plat...
For further actions, you may consider blocking this person and/or reporting abuse
Hi, How can I solve the CSRF on Railway.
Everything is doing well in local. I can even access to my online Database and push or pull data in local. But it is not possible in production. The mater is that I cannot login to my admin page. I can see the login page, but I cannot login. When I try to login, here is the error that is occuring.
What can I do to fix this problem on railway?
Need to set in settings:
Hi, How to know my "your-base-domain"
"your-base-domain" is your project name
You base domain is the root address of your app. In railway you find it in your domains setting for you django application.
I have the same problem! What did you do to solve it? thanks
I didn't be able to solve it.
Until now I am still looking for a solution
Thanks for the feedback. If I find the problem, I'll post the solution.
Maybe we should make a short call for verification. We need your help really
I was able to resolve the csrf_token issue just by replacing the Django version.
The version I was using was Django==4.1.7 and I switched to Django==3.2.17.
Actually i tried "CSRF_TRUSTED_ORIGINS = ["xxxxxxxxx.railway.app"]",i still can't create data in the Django admin,then i try to add "django-cors-headers" in the requirements.txt,then it's work for me :)
I have a error about utf-8
Error: stream did not contain valid UTF-8
I guess it's an error from your HTML file, we'll do justice to properly debugging if I can see a snippet of your code
How can I do that?
I have this error too. how did you solve it
Use whitenoise
I had this error too, change the file encoding for requirements.txt to utf-8
This work for me, thank you so much
can you correct the typo: pip install gunicorn
Fixed. Thank you for your review
seems it works only if debug=1, with debug=0 it doesn't see static files
Thank you so much! Really good article
Aitec/aitx (gatx)
I get this error on my deployed Django webapp. I used bootstrap and also customized my own CSS but the deployed webapp does not seem to find this style.css.
Not Found: /static/css/style.css
My static settings are:
STATIC_URL = 'static/'
STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static")]
STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
I need a help. I am meeting an issue with static files.
Here is my settings.py
After collecting staticfiles and pushing the project to GitHub, Railway can't find the static files, even if they have been pushed on GitHub. Can anyone help me?
In local, everything is working ok.
Everything is ok now.
The whitenoise was missing. I added the whitenoise to the middleware and everything is ok now.
Thanks
Thanks for your feedback
I keep getting this error and then it crashes. I have gunicorn in the requirements.txt file and have the Procfile setup as instructed. Not sure what I'm doing wrong
i had the same. In the step 2, the format of the requirements file should be ".txt" so the command should be
pip freeze > requirements.txt
Yeah, my requirements file is requirements.txt but I'm still getting the same error
I faced a similar error. Use
web: gunicorn 'name-of-application.wsgi'
in Procfile, and deploy in a new service because the deploy configurations gets saved.got this error
11 ERROR: executor failed running [/bin/bash -ol pipefail -c python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt]: exit code: 1
Do i have to upload my Venv folder?
had it resolved, had included a requirement "pywin" which couldn't be installed
It says no deploys for this service.
Hi, guys!
I have the same problem with my application. When I run local, it works perfectly. But after deploy on Railway, it does not find the static files.
I tried to use whitenoise in middleware but the problem continues.
I have other site runs good, but my second one has this problem and I don’t know how solve.
My Code can be seen on my github
engdanilo/estetica
thanks, this post was a great help ^^
my media files dont show when i upload an image on the admin
my settings
I'm getting a server error status on my project. I wonder why... sigh
Did anyone else had problems with the admin ?
After the deploy everything works fine but the admin template is absolutely broken
I have this error, does anyone know what to do?
i have the same problem can you help me please???
Video tutorials
How do you install GDAL on Railway?
django DRF CSRF ERROR .How do you fix it guys?
what this mean?
INABILITY TO HAVE A RAILWAY APP
Nice guidelines. But i am having a problem with having a railway account which i need to deploy my django app. How can i overcome the challenge?
I am facing this Problem while deploying
someone has the same issue and how could fix this error.
May I ask? How did you solve your $PORT issue in Railway? I used sqlite also.
Hi, so I deployed my Django rest framework API project to railway and I've been getting a cors header error
Any idea of how I can fix it?
I have an error of ..... Template does not exist
Code is running perfect on local compute but giving error while deploying. Any solution ?