#Can't Deploy Django
61 messages · Page 1 of 1 (latest)
Project ID: 7fbf82d1-be7c-47ef-b1a4-99574f9c9c2b
It looks like you need to install psycopg2 in order to deploy your Django app. You can find instructions on how to do this in the YouTube tutorial linked in the search results.
which search results?
it's a dependency of a dependency
@narrow raven wondering u have an idea of how to help me here
@remote crystal install psycopg2 into your project then add it to your requirements.txt file like this "pip freeze > requirements.txt".
It should work
ah yea that worked. tysm. But now it's giving me csrf problems :/
I've added it to allowed hosts
The project is not an API? You have html linked directly right?
If you have form actions in your html file, add "{% csrf_token %}
If that's added then you should also add the url that was generated for you by railway in csrf trusten origin
CSRF_TRUSTED_ORIGINS = ["https://RB|Gaura-production-e206.up.railway.app"]
That's an example. Add it in your settings.py file that should work
that's already done
that's also done
website is https://miverva.up.railway.app/
u can see if that works on ur end
if i try to sign up
It says nothing here. That the domain is available to use
did u try to click sign in, and then try to sign up?
# settings.py
ALLOWED_HOSTS = [ 'minerva.up.railway.app' ]
# Application definition
INSTALLED_APPS = [
'home',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
CSRF_TRUSTED_ORIGINS = [
'https://minerva.up.railway.app/'
]```
here's what settings.py looks like
Looks good. But it's saying there's nothing up on the site
wait what
one second
https://minerva.up.railway.app try this?
You sent miverva your settings.py had minerva
ah yea
it's supposed to be minerva
About to sign up
oh it might not let u, it's been a while since i've looked at this project, but can't remember if i had a frontend check for domain emails
This is the problem.
ye
but i already do everything that says
like i have {% csrf_token %} in my templates
and am using csrf middleware
i've even checked cookies
and it works
like i can see a new token being generated
Remove the trailing slash from the url
In your csrf trusted origin
that might just be the problem
Let me know if it works
You're welcome 💙
quick question, this was my first ever project-- and i kept secrets out in the open, including the django generated secret. Do you know any way i can regenerate that?
there's no sensitive info on the wesbite, so i don't care too much
but it'd look p bad if someone tried to check out the repo
put your secrets into a .env file and gitignore it
Ye, but i want to generate a new one since this one’s already out there.
Google has results for that
You can create a secret repo and then push to that repo the website you want to deploy. Railway won't work without those secret keys
the optimal solution would be storing the secrets in the service variables
this is what I'm doing now-- however-- i already exposed it earlier
so generating a new one