import os from flask import Flask from flask_sqlalchemy import SQLAlchemy from twitter import twitter from twitter.models import twitter_db from campaign import campaign from campaign.models import campaign_db import pbrAyctCore.core as core def create_app(): app = Flask('ayct-backend') app.config['SECRET_KEY'] = os.getenv('SECRET_KEY') app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('SQLALCHEMY_DATABASE_URI') app.config['TWITTER_CONSUMER_KEY'] = os.getenv('TWITTER_CONSUMER_KEY') app.config['TWITTER_CONSUMER_SECERT'] = os.getenv('TWITTER_CONSUMER_SECERT') twitter_db.init_app(app) campaign_db.init_app(app) app.register_blueprint(twitter, url_prefix='/twitter') app.register_blueprint(campaign, url_prefix='/campaign') @app.route('/hello') def hello(): return core.getTestString() return app