R
R
Redzonetree2022-04-03 21:29:17
Python
Redzonetree, 2022-04-03 21:29:17

How to update postgressql url python?

Hello!

I have a problem, my code is connecting to the database via the postgressql url on heroku, but since heroku is updating the authorization data (the url has definitely changed), how can i get the working url?

I tried to create a bat file by writing it in heroku config:getand updating the DB_URL variable with the received data, but it’s impossible to run bat on Heroku because it works on linux (unfortunately I found out just now)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ScriptKiddo, 2022-04-03
@Redzonetree

https://devcenter.heroku.com/articles/connecting-h...

import os
import psycopg2

DATABASE_URL = os.environ['DATABASE_URL']

conn = psycopg2.connect(DATABASE_URL, sslmode='require')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question