Esempio n. 1
0
def dashboard():
    from dashboard import create_app
    import socket

    app = create_app()

    url = socket.getfqdn()
    app.run(host=url, debug=True)
Esempio n. 2
0
def init_db():
    from dashboard import create_app
    from dashboard.db import init_db

    app = create_app()

    init_db(app)
    click.echo("Initialized the database.")
Esempio n. 3
0
def dash_app(request):
    app = dashboard.create_app()
    app.config["TESTING"] = True
    app.config["SQLALCHEMY_DATABASE_URI"] = app.config[
        "SQLALCHEMY_TEST_DATABASE_URI"]

    if not database_exists(app.config["SQLALCHEMY_DATABASE_URI"]):
        create_database(app.config["SQLALCHEMY_DATABASE_URI"])

    yield app
    drop_database(app.config["SQLALCHEMY_DATABASE_URI"])
Esempio n. 4
0
def main(args: argparse.Namespace) -> NoReturn:
    if args.debug == 'True':
        debug = True
    elif args.debug == 'False':
        debug = False
    else:
        raise ValueError('Unknown value for "debug". Only "True" and "False" are possible')

    config = args.config
    app = create_app(config, debug)
    app.run(host=args.host, port=args.port, debug=debug)
Esempio n. 5
0
from dashboard import create_app
from datetime import datetime

product = Blueprint('product', __name__)

Happy = Markup('<span>&#127881;</span>')
Sad = Markup('<span>&#128557;</span>')
Sassy = Markup('<span>&#128540;</span>')


def random_string_generator(size=5,
                            chars=string.ascii_uppercase + string.digits):
    return ''.join(random.choice(chars) for _ in range(size))


app = create_app()


# get Product
@product.route('/product', methods=['POST', 'GET'])
@login_required
def get_product():
    ProductsItems = db.session.query(Products).all()
    SituationItems = db.session.query(Situation).all()
    CategoriesItems = db.session.query(Categories).all()
    SizeItems = db.session.query(Size).all()

    return render_template('product.html',
                           ProductsItems=ProductsItems,
                           SituationItems=SituationItems,
                           CategoriesItems=CategoriesItems,
Esempio n. 6
0
 def create_app(self):
     return create_app()
Esempio n. 7
0
# File backend/__init__.py
# -*- Encoding: UTF-8 -*-

"""The __init__.py serves double duty: it will contain the application factory, 
and it tells Python that the flaskr directory should be treated as a package."""

from flask import Flask
import eventlet
eventlet.monkey_patch()

from dashboard import create_app, socketio
app = create_app(debug=True)

if __name__ == "__main__":    
    socketio.run(app, host="0.0.0.0")
# End of file backend.py
Esempio n. 8
0
from sys import exit
from decouple import config

from dashboard.config import config_dict
from dashboard import create_app, db

# WARNING: Don't run with debug turned on in production!
DEBUG = config('DEBUG', default=True, cast=bool)

# The configuration
get_config_mode = 'Debug' if DEBUG else 'Production'

try:

    # Load the configuration using the default values
    app_config = config_dict[get_config_mode.capitalize()]

except KeyError:
    exit('Error: Invalid <config_mode>. Expected values [Debug, Production] ')

app = create_app(app_config)
Migrate(app, db)

if DEBUG:
    app.logger.info('DEBUG       = ' + str(DEBUG))
    app.logger.info('Environment = ' + get_config_mode)
    app.logger.info('DBMS        = ' + app_config.SQLALCHEMY_FLASK_URI)

if __name__ == "__main__":
    app.run()
Esempio n. 9
0
import os
from dashboard import create_app

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

if __name__ == '__main__':
    app.run()
Esempio n. 10
0
    def test_stream_cli(self):
        runner = create_app().test_cli_runner()

        # or by name
        result = runner.invoke(args=["cli", "start_stream"])
        assert 'done' in result.output
Esempio n. 11
0
    def test_my_profile_cli(self):
        runner = create_app().test_cli_runner()

        # or by name
        result = runner.invoke(args=["cli", "my_profile"])
        assert 'done' in result.output
Esempio n. 12
0
# -*- coding: utf-8 -*-
""" wsgi
    wsgi module
"""
import os
from dashboard import create_app

config_file_path = os.environ.get('APP_CONFIG', None)
app = create_app(config_file_path)

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=9000)
Esempio n. 13
0
# -*- coding: utf-8 -*-
# @Author    :  Jason
# @Mail      :  [email protected]
# @File      :  wsgi.py

from flask import render_template, request, json, jsonify

from dashboard import create_app
from dashboard.rally.view import *
from dashboard.tempest.view import *
from test import read_test

from remoteop import SSHOP
from jsonop import writefile

application = create_app()


@application.route('/index', methods=['POST', 'GET'])
@application.route('/index.html', methods=['POST', 'GET'])
@application.route('/', methods=['POST', 'GET'])
def index():
    # if request.method == 'GET':
    #     data = read_test()
    #     return render_template('index.html',data=data)
    if request.method == 'POST':

        data = json.loads(request.get_data())
        ip = data["ip"]
        login_name = data["login_name"]
        password = data["password"]
Esempio n. 14
0
 def create_app(self):
     self.twitterClient = TwitterClient()
     return create_app()
Esempio n. 15
0
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
from dashboard import create_app

app = create_app()

# note: turn debug off when in production
# app.run(debug=True)