def create_app(self): app = create_app() app.config['TESTING'] = True app.config['CSRF_ENABLED'] = False app.config["SQLALCHEMY_DATABASE_URI"] = "mysql://*****:*****@127.0.0.1/scraper_test" app.testing = True return app
from __future__ import with_statement import os import sys from alembic import context from logging.config import fileConfig sys.path.append(os.path.normpath(os.path.abspath(__file__) + '/../../')) from scraper import create_app, db app = create_app() # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config # Interpret the config file for Python logging. # This line sets up loggers basically. fileConfig(config.config_file_name) # add your model's MetaData object here # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata target_metadata = db.Model.metadata # other values from the config, defined by the needs of env.py, # can be acquired: # my_important_option = config.get_main_option("my_important_option") # ... etc.
import scraper import config app = scraper.create_app(config) # [START books_queue] with app.app_context(): books_queue = scraper.tasks.get_books_queue() # [END books_queue] if __name__ == '__main__': app.run(host='127.0.0.1', port=8080, debug=True)