Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

392
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda