#Can't Deploy Django

61 messages · Page 1 of 1 (latest)

remote crystal
#

Can't Deploy a Django app because there is no psycopg2 installed on PATH, my project id is 7fbf82d1-be7c-47ef-b1a4-99574f9c9c2b

balmy yewBOT
#

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.

remote crystal
#

which search results?

narrow raven
#

AI bot answer is funny

#

Is that dependency in your requirements.txt file?

remote crystal
remote crystal
#

@narrow raven wondering u have an idea of how to help me here

cedar dove
#

@remote crystal install psycopg2 into your project then add it to your requirements.txt file like this "pip freeze > requirements.txt".
It should work

remote crystal
#

I've added it to allowed hosts

cedar dove
#

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

#

That's an example. Add it in your settings.py file that should work

remote crystal
remote crystal
#

u can see if that works on ur end

#

if i try to sign up

cedar dove
#

It says nothing here. That the domain is available to use

remote crystal
#
# 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/'
]```
cedar dove
#

Looks good. But it's saying there's nothing up on the site

cedar dove
remote crystal
#

it's supposed to be minerva

cedar dove
#

About to sign up

remote crystal
#

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

cedar dove
#

This is the problem.

remote crystal
#

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

cedar dove
#

Remove the trailing slash from the url

remote crystal
#

ohh

cedar dove
#

In your csrf trusted origin

remote crystal
#

that might just be the problem

cedar dove
#

Let me know if it works

remote crystal
#

tysm

cedar dove
remote crystal
# cedar dove 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

cyan yacht
remote crystal
cedar dove
narrow raven
#

the optimal solution would be storing the secrets in the service variables

remote crystal
#

so generating a new one