Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

396
Visualizações
How to deploy a FastAPI app using PostgreSQL as a database on Heroku

I developed a FastAPI app in a Virtual Environment using an SQLite database but deployed it on Heroku with a PostgresSQL database on Heroku as suggested in the tutorial. Although it worked on my PC, adding PostegresSQL as an addon & replacing the value of SQLALCHEMY_DATABASE_URL in the database.py broke everything. Note that I've properly frozen the dependencies on the requirements.txt file. Yet I can't figure out what went wrong.

For further clarification, I've pushed my code to GitHub & it can be accessed at this repository - Self_calculation.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

If you are using Postgres Addon on Heroku, probably your solution is simple.

Use os.environ to get the connection parameters , don't try to connect directly, it's Heroku's recommended solution from Heroku Postgres

import os

DATABASE_URL = os.environ.get('DATABASE_URL')
over 4 years ago · Santiago Trujillo Relatório

0

I just need to run this:
1)heroku git:remote -a my_heroku_app_name

2)heroku logs --tail

after that I could see my problem.
In my case I forgot to change postgres url in alembic.ini file

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda