[Python] Integrating Flask, Github, Render, Superbase: How can I access an external SQL in my...

Discussão em 'Python' iniciado por Stack, Janeiro 25, 2025.

  1. Stack

    Stack Membro Participativo

    I made a flask app using Python. This app gets all my publications and let me have a real-time update. I used GitHub to deploy my app and render to load the front-end version of that. Finally, I managed to have a superbase account to have a SQL operating within the app. This way, this will allow me to add/edit/remove publication from my app online.

    [​IMG]

    However, I can't connect to my sql

    in my app.py, I have this:

    if os.getenv("RENDER_ENV"):
    # Running on Render, use the provided DATABASE_URL
    DATABASE_URL = os.getenv("DATABASE_URL",
    "postgresql://postgres:mypass@db.mysupabaseinstance.supabase.co:5432/postgres?sslmode=require")
    else:
    # Running locally, use local PostgreSQL
    DATABASE_URL = "postgresql://flask_user:mypass@localhost:5432/flask_pub"


    And when render tries to deploy, this is the message

    Database initialization error: connection to server at "db.mysupabaseinstance.supabase.co" (myipv6), port 5432 failed: Network is unreachable
    File "/opt/render/project/src/.venv/bin/gunicorn", line 8, in <module>
    Is the server running on that host and accepting TCP/IP connections?
    sys.exit(run())


    Question -- How can I "bypass" this problem and access my SQL database to update my publications online ? Question 2 -- Any easy solution that can bring together Flash, github, SQL for free ?

    I looked up other posts here and I did not find anything related to my question.

    Continue reading...

Compartilhe esta Página