Пример #1
0
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)
Пример #2
0
async def send_file(filename):
    target = os.path.join(APP_ROOT, 'static/')
    return send_from_directory(static, filename)
Пример #3
0
def security():
    return send_from_directory(app.config['CONTENT_FOLDER'], 'security.txt')
Пример #4
0
def robots():
    return send_from_directory(app.config['CONTENT_FOLDER'], 'robots.txt')
Пример #5
0
def uploaded_file(filename):
    return send_from_directory("outputs", f"{filename}.png")
Пример #6
0
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)
Пример #7
0
def send_index():
    return send_from_directory("./frontend", "index.html")
Пример #8
0
async def riot(path):
    """
    Specific end point for riot
    """
    return send_from_directory(app.static_folder, 'riot.txt')
Пример #9
0
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)
Пример #11
0
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)
Пример #12
0
def send_static(filename):
    return send_from_directory("static/", filename)
Пример #13
0
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')