librelist archives

« back to archive

Issues with Flask-SQLAlchemy and Windows

Issues with Flask-SQLAlchemy and Windows

From:
Willy Cordeiro
Date:
2012-06-23 @ 08:40
I'm having trouble getting Flask-SQLAlchemy working.
Here's the relevant code.
http://dpaste.com/762643/

Basically you're looking at what would be my __init__.py, models.py and
settings.py file.

So I defined a basic model, set up my app and my settings file. Then I go
into the interactive shell and try these commands.
http://dpaste.com/762626/

But then I get a ProgrammingError exception once I try committing to the
db. I don't know what's really wrong, I know SQLAlchemy is installed as is
Psycopg2 and PostgreSQL 9.1.4 and I've had no trouble connecting to or
using PostgreSQL with Django or Bottle so far.


-Wellington "Willy" Cordeiro

Re: [flask] Issues with Flask-SQLAlchemy and Windows

From:
Simon Sapin
Date:
2012-06-23 @ 09:21
Le 23/06/2012 10:40, Willy Cordeiro a écrit :
> So I defined a basic model, set up my app and my settings file. Then I
> go into the interactive shell and try these commands.
> http://dpaste.com/762626/

For some reason db.create_all() does not create your user table. (Note 
that no CREATE TABLE statement is logged.) Try importing blog.models 
(thus making sure that your User model exists) before calling 
db.create_all()

Regards,
-- 
Simon Sapin

Re: [flask] Issues with Flask-SQLAlchemy and Windows

From:
Simon Sapin
Date:
2012-06-23 @ 09:24
Le 23/06/2012 11:21, Simon Sapin a écrit :
> Le 23/06/2012 10:40, Willy Cordeiro a écrit :
>> >So I defined a basic model, set up my app and my settings file. Then I
>> >go into the interactive shell and try these commands.
>> >http://dpaste.com/762626/
> For some reason db.create_all() does not create your user table. (Note
> that no CREATE TABLE statement is logged.) Try importing blog.models
> (thus making sure that your User model exists) before calling
> db.create_all()

By the way, what you got was not just a ProgrammingError. The important 
part was just after that:

 > (ProgrammingError) relation "user" does not exist

"Relation" is what PostgreSQL calls a table.