def run(): app = create_app() with app.app_context(): status = sendgrid_email( subject="testing mail again", recipients=['*****@*****.**'], text_message="What is up?" ) print(status)
def run(email=None, password=None): app = create_app() with app.app_context(): user = create_user(email, password) form_key = os.environ.get('DEFAULT_TYPEFORM_KEY', '') title = os.environ.get('DEFAULT_TYPEFORM_TITLE', '') live_url = os.environ.get('DEFAULT_TYPEFORM_LIVE_URL', '') edit_url = os.environ.get('DEFAULT_TYPEFORM_EDIT_URL', '') form = create_typeform(form_key, title, user, live_url=live_url, edit_url=edit_url) generate_fake_responses(form, 20)
import os from flask_migrate import MigrateCommand from flask_script import Manager, Shell, Server from typeseam.app import create_app, db app = create_app() manager = Manager(app) def _make_context(): """Return context dict for a shell session so you can access app and db by default. """ return {"app": app, "db": db} manager.add_command("server", Server(port=os.environ.get("PORT", 9000))) manager.add_command("shell", Shell(make_context=_make_context)) manager.add_command("db", MigrateCommand) if __name__ == "__main__": manager.run()
def run(): app = create_app() with app.app_context(): generate_fake_data()
def run(emails): app = create_app() with app.app_context(): for email in emails: invite_new_user(email)
def test_production_config(): os.environ["CONFIG"] = "typeseam.settings.ProdConfig" app = create_app() assert app.config["ENV"] == "prod" assert app.config["DEBUG"] is False
def test_dev_config(): os.environ["CONFIG"] = "typeseam.settings.DevConfig" app = create_app() assert app.config["ENV"] == "dev" assert app.config["DEBUG"] is True