[Python] Cannot link python/flask app to sqlAlchemy

Discussão em 'Python' iniciado por Stack, Maio 13, 2025.

  1. Stack

    Stack Membro Participativo

    I am doing a course for my bootcamp in which it is introducing sqlAlchemy, i have followed along, restarted 2 or 3 times, and checked every little thing but i cannot get the two to link up. here is my process: -i make a folder -make a venv and activate it -install psycopg, flask-sqlalchemy, ipython -make app.py file -put this code into file:

    from flask import Flask, request, flash, session, redirect, render_template
    from flask_sqlalchemy import SQLAlchemy


    app = Flask(__name__)

    app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql:///dogs'

    db = SQLAlchemy()
    db.app = app
    db.init_app(app)


    app.config['SECRET_KEY'] = 'vdjndv'


    -then i go into ipython, run the file and type db.

    the video shows an object returned but all i get is . i have tried so many different things from other forums and nothing is working. Help is much appreciated as i cannot continue until i figure out this core step, thanks!

    Continue reading...

Compartilhe esta Página