Skip to content

Instantly share code, notes, and snippets.

@Deviad
Created May 29, 2017 18:24
Show Gist options
  • Save Deviad/aae47817e54f370bdfb4140beda2ce96 to your computer and use it in GitHub Desktop.
Save Deviad/aae47817e54f370bdfb4140beda2ce96 to your computer and use it in GitHub Desktop.
Flask init
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