def content_file(filename): if filename and allowed_file(filename): filename = secure_filename(filename) return send_from_directory(app.config['CONTENT_FOLDER'], filename) raise abort(404)
async def send_file(filename): target = os.path.join(APP_ROOT, 'static/') return send_from_directory(static, filename)
def security(): return send_from_directory(app.config['CONTENT_FOLDER'], 'security.txt')
def robots(): return send_from_directory(app.config['CONTENT_FOLDER'], 'robots.txt')
def uploaded_file(filename): return send_from_directory("outputs", f"{filename}.png")
def favicon(): if os.path.exists(os.path.join(app.config['CONTENT_FOLDER'], 'favicon.ico')): return send_from_directory(app.config['CONTENT_FOLDER'], 'favicon.ico') abort(404)
def send_index(): return send_from_directory("./frontend", "index.html")
async def riot(path): """ Specific end point for riot """ return send_from_directory(app.static_folder, 'riot.txt')
def favicon(): return send_from_directory(os.path.join(app.root_path), 'favicon.ico', mimetype='image/vnd.microsoft.icon')
def show(path=None): if path is None: return send_from_directory(swagger_ui._static_folder, "index.html") return send_from_directory(swagger_ui._static_folder, path)
from quart import Quart, send_from_directory from App01.server import blueprint app = Quart(__name__) app.add_url_rule('/static/<filename', send_from_directory('static/dist')) app.register_blueprint(blueprint) @app.route('/') # @app.route('/static/<filename>') async def index(filename='index.html'): # return 'Hello World' return await send_from_directory('static/dist', filename) # @app.route('/test') # async def index(): # return 'Hello World' def start(host='localhost', port=9090, debug=True): app.run(host=host, port=port, debug=debug, use_reloader=True)
def send_static(filename): return send_from_directory("static/", filename)
def serve(path): if path and (Path(app.static_folder) / path).exists(): return send_from_directory(app.static_folder, path) else: return send_from_directory(app.static_folder, 'index.html')