def create_app(): app = Flask(__name__, static_folder="./dist/static", template_folder="./dist") if os.environ["RUN_ENVIRONMENT"] == 'network': app.config[ 'SQLALCHEMY_DATABASE_URI'] = "postgresql+psycopg2://{user}:{pw}@{url}/{db}".format( user=os.environ["DB_USER"], pw=os.environ["DB_PASS"], url=os.environ["DB_URL"], db=os.environ["DB_NAME"]) print("network database") else: app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///{}".format( os.path.join(project_dir, "userdata.db")) print("local database") # app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///{}".format(os.path.join(project_dir, "userdata.db")) app.config['SQLALCHEMY_ECHO'] = True db.init_app(app) app.register_blueprint(user_api) return app
def create_app(): app = Flask(__name__, static_folder="./dist/static", template_folder="./dist") app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///{}".format( os.path.join(project_dir, "userdata.db")) app.config['SQLALCHEMY_ECHO'] = True db.init_app(app) app.register_blueprint(user_api) return app
def create_app(): app = Flask(__name__, static_folder = "./dist/static", template_folder = "./dist" ) # app.config['SQLALCHEMY_DATABASE_URI'] = "postgresql+psycopg2://{user}:{pw}@{url}/{db}".format(user=os.environ["DB_USER"],pw=os.environ["DB_PASS"],url=os.environ["DB_URL"],db=os.environ["DB_NAME"]) # app.config['SQLALCHEMY_ECHO'] = True db.init_app(app) app.register_blueprint(user_api) app.register_blueprint(email_api) app.secret_key = os.environ["SECRET_KEY"] return app # def setup_database(app): # with app.app_context(): # db.create_all() # db.drop_all()
def create_app(): app = Flask(__name__, static_folder="./dist/static", template_folder="./dist") app.config[ 'SQLALCHEMY_DATABASE_URI'] = "postgresql+psycopg2://{user}:{pw}@{url}/{db}".format( user=os.environ["DB_USER"], pw=os.environ["DB_PASS"], url=os.environ["DB_URL"], db=os.environ["DB_NAME"]) app.config['SQLALCHEMY_ECHO'] = True app.register_blueprint(sms_api) app.register_blueprint(social_api) app.register_blueprint(status_api) app.register_blueprint(email_api) app.register_blueprint(users_api) app.secret_key = os.environ["SECRET_KEY"] db.init_app(app) return app
def create_app(): """ Flask application factory """ # Create Flask app load app.config app = Flask(__name__) app.config.from_object(ConfigClass) # app.config.from_pyfile("configs.py") # adding user Blueprint app.register_blueprint(admin_bp) app.register_blueprint(stream_bp) app.register_blueprint(user_bp) app.register_blueprint(drive_bp) # Initialize Flask-SQLAlchemy db.init_app(app) # Create all database tables with app.app_context(): # db.drop_all() db.create_all() return app