예제 #1
0
def serve(env):
    blockd3_path = os.path.abspath(os.path.dirname(__file__))
    sys.path.append(blockd3_path)

    from app.app import make_app
    app = make_app(env)

    port = {"dev": 5000, "prod": 5001, "test": 5002}[env]

    app.run(port=port)
예제 #2
0
async def create_app(site, tier, name, port=None, connect_to=[]):
    if port is None:
        port = unused_tcp_port()
    application = app.make_app(site,
                               tier,
                               name,
                               "here",
                               "black",
                               port=port,
                               connect_to=connect_to)

    return "http://localhost:%d/" % port, application
예제 #3
0
def serve(env):
    blockd3_path = os.path.abspath(os.path.dirname(__file__))
    sys.path.append(blockd3_path)

    from app.app import make_app
    app = make_app(env)
    
    port = {
        "dev": 5000,
        "prod": 5001,
        "test": 5002
    }[env]
    
    app.run(port=port)
예제 #4
0
    def initialize(self):
        # load settings
        # settings = config.settings
        self.set_working_dir()
        parse_options()
        # create app and update settings
        init_log()
        from app.app import make_app
        self.app = make_app(options.COOKIE_SECRET, options.DEBUG)

        # send ping to web socket connect users
        BeatPing()

        self._get_loop()
        from lib.heartbeat import heartbeat
        self.loop.call_later(0.5, heartbeat.ticker, app=self.app)
        self.loop.run_sync(self.app.mq.connect)
        self._init_subscribe()
예제 #5
0
def html():
    proj()
    print ". generating production html"
    sh.mkdir("-p", "dist/frame")

    blockd3_path = os.path.abspath(os.path.dirname(__file__))
    sys.path.append(blockd3_path)

    from app.app import make_app
    app = make_app("prod")

    prod_files = {
        "dist/index.html": "/dist/",
        "dist/frame/index.html": "/dist/frame/"
    }

    for prod_file, url in prod_files.items():
        print ".. writing ", prod_file
        open(prod_file, "w").write(app.test_client().get(url).data)
예제 #6
0
def html():
    proj()
    print ". generating production html"
    sh.mkdir("-p", "dist/frame")
    
    blockd3_path = os.path.abspath(os.path.dirname(__file__))
    sys.path.append(blockd3_path)

    from app.app import make_app
    app = make_app("prod")
    
    prod_files = {
        "dist/index.html": "/dist/",
        "dist/frame/index.html": "/dist/frame/"
    }
    
    for prod_file, url in prod_files.items():
        print ".. writing ", prod_file
        open(prod_file, "w").write(
            app.test_client().get(url).data
        )
예제 #7
0
from random import choice
from base64 import b64encode
from app.app import make_app
from app.models import PPE

app, db, migrate, bootstrap, login = make_app(__name__)


def read_image(name):
    with open(name, 'rb') as f:
        data = f.read()
        return b"data:image/jpeg;base64," + b64encode(data)


IMAGES = list(map(read_image, ['mask_1.jpeg', 'mask_2.jpeg', 'mask_3.jpg']))

with app.app_context():
    for name in ['N90', 'N95', 'N97', 'N99', 'Surgical']:
        for size in ['Small', 'Medium', 'Large'
                     ]:  # I'm pretty sure this isn't how masks are sized
            ppe = PPE(
                sku="{}-{}".format(name.upper(), size[0]),
                desc=
                "A {} mask in the {} size. Suitable for various uses. Not flame resistant. Does not contain platnum. Produced by the Sheinhardt Wig Company."
                .format(name, size),
                img=choice(IMAGES),
            )
            db.session.add(ppe)
    db.session.commit()
예제 #8
0
파일: test_app.py 프로젝트: Kxrr/pdo
 def get_app(self, loop):
     return make_app(loop=loop)
예제 #9
0
def cli(loop, aiohttp_client):
    app = make_app()
    return loop.run_until_complete(aiohttp_client(app))
예제 #10
0
from app.app import make_app
from flask_script import Manager
from flask import url_for
from urllib.parse import unquote


app = make_app()
manager = Manager(app)


@manager.command
def list_routes():
    import urllib
    output = []
    for rule in app.url_map.iter_rules():

        options = {}
        for arg in rule.arguments:
            options[arg] = "[{0}]".format(arg)

        methods = ','.join(rule.methods)
        url = url_for(rule.endpoint, **options)
        line = unquote("{:50s} {:20s} {}".format(rule.endpoint, methods, url))
        output.append(line)

    for line in sorted(output):
        print(line)


if __name__ == '__main__':
    manager.run()
예제 #11
0
파일: conftest.py 프로젝트: xamaral/k8s-sso
def cli(loop, aiohttp_client):
    load_dotenv('secrets.env')
    app = make_app()
    return loop.run_until_complete(aiohttp_client(app))
예제 #12
0
async def app() -> Application:
    return make_app()
예제 #13
0
from aiohttp import web

from app.app import make_app

web.run_app(make_app())