def dashboard(): from dashboard import create_app import socket app = create_app() url = socket.getfqdn() app.run(host=url, debug=True)
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.")
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"])
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)
from dashboard import create_app from datetime import datetime product = Blueprint('product', __name__) Happy = Markup('<span>🎉</span>') Sad = Markup('<span>😭</span>') Sassy = Markup('<span>😜</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,
def create_app(self): return create_app()
# 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
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()
import os from dashboard import create_app config_name = os.getenv('FLASK_CONFIG') app = create_app(config_name) if __name__ == '__main__': app.run()
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
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
# -*- 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)
# -*- 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"]
def create_app(self): self.twitterClient = TwitterClient() return create_app()
# -*- 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)