Created
May 29, 2017 18:24
-
-
Save Deviad/aae47817e54f370bdfb4140beda2ce96 to your computer and use it in GitHub Desktop.
Flask init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template | |
from flask_sqlalchemy import SQLAlchemy | |
from sqlalchemy import create_engine | |
from sqlalchemy_utils import database_exists, create_database | |
from app.users_bundle.controllers import users_bundle | |
app = Flask(__name__) | |
app.config.from_object('config.DevelopmentConfig') | |
db = SQLAlchemy(app) | |
engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI']) | |
if not database_exists(engine.url): | |
print('Creating the database') | |
create_database(engine.url) | |
else: | |
print('The database exists: ' + str(database_exists(engine.url))) | |
app.register_blueprint(users_bundle) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment