diff options
| author | Teddy Wing | 2015-01-31 17:55:01 -0500 | 
|---|---|---|
| committer | Teddy Wing | 2015-01-31 17:55:01 -0500 | 
| commit | f5115419d305c743a8df615c4cf16dcb07642062 (patch) | |
| tree | 6b5d488707ef270ccef2cd241a8694dd99c3aabf /app.py | |
| parent | e15643dd00d14e271d389a9a27f3fd0ae130981e (diff) | |
| download | edu-net-f5115419d305c743a8df615c4cf16dcb07642062.tar.bz2 | |
Add database & user models
* Database courtesy of Flask-SQLAlchemy
* User models from Flask-User
Diffstat (limited to 'app.py')
| -rw-r--r-- | app.py | 18 | 
1 files changed, 18 insertions, 0 deletions
| @@ -1,6 +1,24 @@  from flask import Flask + +from flask_user import SQLAlchemyAdapter, UserManager + +from modules.shared.models import db +from modules.user.models import User, UserAuth +  app = Flask(__name__) +app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///development.db' +app.config['SECRET_KEY'] = 'this should definitely be changed to an ' \ +    'environment variable' +db.init_app(app) + +with app.app_context(): +    db.create_all() + +# Setup Flask-User +db_adapter = SQLAlchemyAdapter(db,  User, UserAuthClass=UserAuth) +user_manager = UserManager(db_adapter, app) +  @app.route("/")  def hello():      return "Hello World!" | 
