Flask : sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) relation “users” does not exist

后端 未结 2 1645
情歌与酒
情歌与酒 2021-02-20 11:09

I am working on a flask app based on http://code.tutsplus.com/tutorials/intro-to-flask-signing-in-and-out--net-29982.

As part of the tut I\'m trying to connect

2条回答
  •  你的背包
    2021-02-20 11:50

    The tutorial you linked to has a section called "Create a User Model", under which it tells you how to use CREATE TABLE ... to create your users table. It gives some MySQL-specific syntax for this, although you are apparently using Postgres, so your command will be slightly different.

    But the screenshot you posted (from pgAdmin?) clearly shows that the "public" schema in the flask database has zero tables, so obviously you have not created this table yet. You'll have to create this table, you should be able to do so through pgAdmin, something like:

    CREATE TABLE users (
      uid serial PRIMARY KEY,
      firstname varchar(100) not null,
      ... follow the guide for the rest of the columns ...
    );
    

提交回复
热议问题