add the tip for SQLAlchemy db and model namespace
parent
5d7ab336b5
commit
b54ca636cd
1 changed files with 2 additions and 0 deletions
|
|
@ -424,6 +424,8 @@ Here is the `/app/__init__.py` :
|
||||||
#app.register_blueprint(postsModule)
|
#app.register_blueprint(postsModule)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Our SQLAlchemy db instance and models (User) are separated in two files, you need import both of them into namespace, which is done by `from app.users.views import mod as usersModule` implicitly. Otherwise the `db.create_all()` will do nothing.
|
||||||
|
|
||||||
Let's activate your virtualenv and initialize your database:
|
Let's activate your virtualenv and initialize your database:
|
||||||
|
|
||||||
user@Machine:~/Projects/dev$ . env/bin/activate
|
user@Machine:~/Projects/dev$ . env/bin/activate
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue