Beispiel #1
0
 def create_app(self):
     ''' creates the testing app and sets it to self.app '''
     app = create_app(debug=True)
     app.config['TESTING'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False
     return app
Beispiel #2
0
 def setUp(self):
     self.app = create_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
     db.create_all()
     # self.client = self.app.test_client(use_cookies=True)
     self.client = self.app.test_client()
Beispiel #3
0
 def create_app(self):
     ''' creates the testing app and sets it to self.app '''
     app = create_app(debug=True)
     app.config['TESTING'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False
     return app
Beispiel #4
0
    def create_app(self):

        config_name = 'testing'
        app = create_app(config_name)
        app.config.update(
            SQLALCHEMY_DATABASE_URI='mysql://*****:*****@localhost/weather_test'
        )
        return app
Beispiel #5
0
def test_app():
    test_app = create_app(TestConfig)
    app_context = test_app.app_context()
    app_context.push()

    yield test_app

    app_context.pop()
Beispiel #6
0
def main(argv):
    app = myapp.create_app()

    # Turn on debug mode, to make your life easier in development
    # http://flask.pocoo.org/docs/0.10/quickstart/#debug-mode
    app.debug = True

    app.run(port=8080,
            host="0.0.0.0")
Beispiel #7
0
    def create_app(self):

        config_name = 'testing'
        self.app = create_app(config_name)
        self.app.config.update(
            SQLALCHEMY_DATABASE_URI=
            "postgresql://*****:*****@localhost/test_catalog"
            #self.app.config.update(SQLALCHEMY_DATABASE_URI= "mysql://*****:*****@localhost/test_catalog"
        )
        return self.app
Beispiel #8
0
def app():
    app = create_app()
    app.config.from_object(TestingConfig)

    context = app.app_context()
    context.push()

    yield app

    context.pop()
Beispiel #9
0
def test_client():
    flask_app = create_app('flask_test.cfg')

    # Flask provides a way to test your application by exposing the Werkzeug test Client
    # and handling the context locals for you.
    testing_client = flask_app.test_client()

    # Establish an application context before running the tests.
    ctx = flask_app.app_context()
    ctx.push()

    yield testing_client  # this is where the testing happens!

    ctx.pop()
Beispiel #10
0
def app(request):
    EnvConfig.SQLALCHEMY_DATABASE_URI = EnvConfig.TEST_DATABASE_URI
    EnvConfig.TESTING = True
    # App Creation
    app_ = create_app('config')

    # Establish an application context before running the tests.
    ctx = app_.app_context()
    ctx.push()

    def teardown():
        ctx.pop()

    request.addfinalizer(teardown)
    return app_
Beispiel #11
0
#!/usr/bin/env python
from myapp import create_app, db
from myapp.models import User

if __name__ == '__main__':
	app = create_app('development')
	with app.app_context():
		db.create_all()
	app.run()
Beispiel #12
0
#     # get 请求的参数
#     age = request.args.get('age', 0, int)

#     #### session
#     # set
#     session['session_1'] = 'cc'
#     # get
#     session_1 = escape(session['session_1'])


#     #### cookies
#     # get
#     cookie_1 = request.cookies.get('cookie_1')
#     # set 
#     ret = 'hello world! %s, age: %s' % (name, age)
#     resp = make_response(ret)
#     resp.set_cookie('cookie_1', 'cc')
#     return resp

# @app.errorhandler(500)
# def server_error(error):
#     return "sorry. server error", 500

from myapp import create_app

app = create_app()

if __name__ == '__main__':
    app.run(host="127.0.0.1", port=5000, debug=True)
Beispiel #13
0
import os

from flask_script import Manager, Shell
from flask_migrate import Migrate, MigrateCommand

from myapp import create_app, db
from myapp.models import User, Role

myapp = create_app(os.getenv('STAGE') or 'default')
manager = Manager(myapp)
migrate = Migrate(myapp, db)


def make_shell_context():
    return dict(myapp=myapp, db=db, User=User, Role=Role)


manager.add_command("shell", Shell(make_context=make_shell_context))
manager.add_command('db', MigrateCommand)


@manager.command
def test():
    """Run the unit tests."""
    import unittest
    tests = unittest.TestLoader().discover('tests')
    unittest.TextTestRunner(verbosity=2).run(tests)


if __name__ == '__main__':
    manager.run()
Beispiel #14
0
from myapp import create_app

app = create_app("debug")
Beispiel #15
0
from flask.ext.sqlalchemy import SQLAlchemy
from myapp import create_app
from myapp import models
app = create_app("development")
from myapp import db
with app.app_context():
    db.create_all()
Beispiel #16
0
def client():
    app = create_app()
    return app.test_client()
Beispiel #17
0
import os
import uuid
import MySQLdb

from flask import render_template, request, url_for, redirect, Response, make_response
from colorscale import colorscale
import myapp

from game_summary_stats import GameTape
from parser import LogFileParser
from persistence import Game, PersistenceManager, LuckResult, LuckMeasure
from plots.player_plots import LuckPlot, VersusPlot, AdvantagePlot, DamagePlot
from xwingmetadata import XWingMetaData
import xwingmetadata

app =  myapp.create_app()
UPLOAD_FOLDER = "static"
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
UPLOAD_FOLDER = "static"
ALLOWED_EXTENSIONS = set( ['png'])



here = os.path.dirname(__file__)
static_dir = os.path.join( here, app.config['UPLOAD_FOLDER'] )

ADMINS = ['*****@*****.**']

session = myapp.db_connector.get_session()

@app.teardown_appcontext
Beispiel #18
0
    def create_app(self):
        configs = {"SQLALCHEMY_DATABASE_URI":self.SQLALCHEMY_DATABASE_URI, "TESTING":self.TESTING}

        return create_app(configs)
	def setUp(self): 
		self.app = create_app("test.cfg")
		self.client = self.app.test_client()
		self.ctx = self.app.test_request_context()
		self.ctx.push()
		create_all()
Beispiel #20
0
 def setUp(self):
     self.app = create_app()
     self.app_context = self.app.app_context()
     self.app_context.push()
     self.client = self.app.test_client(use_cookies=True)
Beispiel #21
0
# @Date:   2016-06-19 18:36:54
# @Last modified by:   Brian Cherinka
# @Last Modified time: 2016-06-19 18:39:21

from __future__ import print_function, division, absolute_import

from flask import Flask
from werkzeug.contrib.profiler import ProfilerMiddleware
from myapp import create_app
import argparse

# --------------------------
# Parse command line options
# --------------------------
parser = argparse.ArgumentParser(description='Script to start the SDSS API.')
parser.add_argument('-p', '--port', help='Port to use in debug mode.', default=5000, type=int, required=False)
args = parser.parse_args()


# Start the Profiler app and runs in DEBUG mode

app = create_app(debug=True)

app.config['PROFILE'] = True
app.wsgi_app = ProfilerMiddleware(app.wsgi_app)
app.run(debug=True, port=args.port)




Beispiel #22
0
def app():
    app = create_app()
    app.debug = True
    return app
# coding: utf-8
from myapp import create_app, db


def create_all_db(app):
    with app.app_context():
        db.create_all()

if __name__ == '__main__':
    app = create_app('config')
    create_all_db(app)
    app.run(host='0.0.0.0', debug=True)
Beispiel #24
0
def app():
    app = create_app("development")
    app.debug = True
    return app
Beispiel #25
0
 def create_app(self):
     return create_app(self)
Beispiel #26
0
import os
from myapp import create_app
from flask_script import Manager, Shell, Server

app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)


def make_shell_context():
    return dict(app=app, User=User)


manager.add_command("shell", Shell(make_context=make_shell_context))
manager.add_command("runserver", Server(host='0.0.0.0', port=5000))

if __name__ == '__main__':
    manager.run()
def app():
    app = create_app()
    return app
Beispiel #28
0
 def create_app():
     """
     Creates a flask instance for specific for development
     """
     return create_app(ENVIRONMENTS['development'])
Beispiel #29
0
 def create_app():
     """
     Creates a flask instance for specific for testing
     """
     return create_app(ENVIRONMENTS['testing'])
Beispiel #30
0
# coding: utf-8
from myapp import create_app, db


def create_all_db(app):
    with app.app_context():
        db.create_all()


if __name__ == '__main__':
    app = create_app('config')
    create_all_db(app)
    app.run(host='0.0.0.0', debug=True)
Beispiel #31
0
def app():
    app = create_app(SPACE_ID, DELIVERY_API_KEY, environment_id=TESTING_ENV)
    app.debug = True
    return app
Beispiel #32
0
import os

# internal
from myapp import create_app


config_name = os.getenv('FLASK_CONFIG')
app = create_app(config_name)


if __name__ == '__main__':
    app.run()
Beispiel #33
0
"""
Script contains commands that can be called from the command line
to a Manager instance, for the flask application
"""
from os import getenv

from flask import current_app
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand

from instance import ENVIRONMENTS
from myapp import create_app, db

ENV = getenv('BUCKETLIST_ENV') or 'development'
APP = create_app(ENVIRONMENTS.get(ENV))

MIGRATE = Migrate(APP, db)
MANAGER = Manager(APP)
MANAGER.add_command('db', MigrateCommand)

if __name__ == '__main__':
    MANAGER.run()
Beispiel #34
0
import os
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from myapp import create_app
from  myapp import db

config_name=os.getenv('APP_SETTINGS')
app = create_app('development')

migrate = Migrate(app, db)
manager = Manager(app)

manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
   manager.run()


Beispiel #35
0
    def create_app(self):

        # pass in test configuration
        return create_app(self)
Beispiel #36
0
#!/usr/bin/env python
# encoding: utf-8

from __future__ import print_function, division, absolute_import
import argparse
from myapp import create_app

# --------------------------
# Parse command line options
# --------------------------
parser = argparse.ArgumentParser(description='Script to start Flask app.')
parser.add_argument('-d', '--debug', help='Launch app in debug mode.', action="store_true", required=False)
parser.add_argument('-p', '--port', help='Port to use in debug mode.', default=5000, type=int, required=False)

args = parser.parse_args()

# ------------------
# My Flask App
# ------------------
app = create_app(debug=args.debug)

# ------------------
# Start the app
# ------------------
if __name__ == "__main__":
    app.run(debug=args.debug, port=args.port)


Beispiel #37
0
"""Initialize set up for heroku"""

from myapp import create_app

import os

app = create_app('default')


if __name__ == '__main__':
    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0', port=port)
 
Beispiel #38
0
 def setUp(self):
     self.app = create_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
     db.create_all()
Beispiel #39
0
 def create_app():
     """
     Creates a flask instance for testing
     """
     return create_app(ENVIRONMENTS.get('testing'))
Beispiel #40
0
from myapp import create_app


app = create_app('Production')
app.run(host='0.0.0.0',debug=True)
Beispiel #41
0
from myapp import create_app

if __name__ == "__main__":
    create_app()
Beispiel #42
0
from myapp import create_app
from flaskwebgui import FlaskUI #get the FlaskUI class

app = create_app()

# Feed it the flask app instance 
# ui = FlaskUI(app)

# do your logic as usual in Flask
# @app.route("/")
# def index():
#   return "It works!"

# call the 'run' method
if __name__ == "__main__":
  app.run()
  # ui.run()
Beispiel #43
0
#!/usr/bin/env python
import os
from myapp import create_app, db
from myapp.models import User, Role, Post, Student, Class, Follow, Comment
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand

apl = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(apl)
migrate = Migrate(apl, db)


def make_shell_context():
    return dict(apl=apl, db=db, User=User, Role=Role, Post=Post, Student=Student, Class=Class, Follow=Follow, Comment=Comment)
manager.add_command("shell", Shell(make_context=make_shell_context))
manager.add_command('db', MigrateCommand)


@manager.command
def deploy():
	from flask.ext.migrate import upgrade
	from myapp.models import Role, User

	db.create_all()
	Role.insert_roles()


if __name__ == '__main__':
    manager.run()