Python flask.current_app.send_static_file() Examples

The following are 16 code examples of flask.current_app.send_static_file(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module flask.current_app , or try the search function .
Example #1
Source File: run_emote.py    From emoter with MIT License 6 votes vote down vote up
def upload_file():
    if request.method == 'POST':
        # check if the post request has the file part
        if 'file' not in request.files:
            flash('No file part')
            return current_app.send_static_file('templates/emote-home.html')
        file = request.files['file']
        # if user does not select file, browser also
        # submit a empty part without filename
        if file.filename == '':
            flash('No selected file')
            return redirect(request.url)
        if file and allowed_file(file.filename):
            filename = secure_filename(file.filename)
            file.save(filename)
            em.analyzeCSV(filename)
            return redirect(url_for('static',
                                    filename="results.csv")) 
Example #2
Source File: views.py    From Python24 with MIT License 5 votes vote down vote up
def favicon():
    # 访问网站图标,send_static_file 是flask系统访问静态文件所调用的方法
    return current_app.send_static_file('news/favicon.ico') 
Example #3
Source File: run_emoter.py    From emoter with MIT License 5 votes vote down vote up
def home():
    return current_app.send_static_file('templates/emoter-home.html') 
Example #4
Source File: run_emote.py    From emoter with MIT License 5 votes vote down vote up
def home():
    global firstTime
    if firstTime:
        firstTime = False
        # Runs Emote for the first time to load the initial pickled data (first time analysis is always slower)
        em.getInput("")
    return current_app.send_static_file('templates/emote-home.html')


# Upload CSV for Emote mass analysis 
Example #5
Source File: run_emote.py    From emoter with MIT License 5 votes vote down vote up
def static_file(path):
    return app.send_static_file(path) 
Example #6
Source File: static_files.py    From confidant with Apache License 2.0 5 votes vote down vote up
def index():
    return current_app.send_static_file('index.html') 
Example #7
Source File: static_files.py    From confidant with Apache License 2.0 5 votes vote down vote up
def goodbye():
    return current_app.send_static_file('goodbye.html') 
Example #8
Source File: static_files.py    From confidant with Apache License 2.0 5 votes vote down vote up
def favicon():
    return current_app.send_static_file('favicon.ico') 
Example #9
Source File: static_files.py    From confidant with Apache License 2.0 5 votes vote down vote up
def not_found():
    return current_app.send_static_file('404.html') 
Example #10
Source File: static_files.py    From confidant with Apache License 2.0 5 votes vote down vote up
def robots():
    return current_app.send_static_file('robots.txt') 
Example #11
Source File: static_files.py    From confidant with Apache License 2.0 5 votes vote down vote up
def modules(path):
    return current_app.send_static_file(os.path.join('modules', path)) 
Example #12
Source File: static_files.py    From confidant with Apache License 2.0 5 votes vote down vote up
def static_proxy(path):
    return current_app.send_static_file(os.path.join('styles', path)) 
Example #13
Source File: static_files.py    From confidant with Apache License 2.0 5 votes vote down vote up
def scripts(path):
    return current_app.send_static_file(os.path.join('scripts', path)) 
Example #14
Source File: static_files.py    From confidant with Apache License 2.0 5 votes vote down vote up
def fonts(path):
    return current_app.send_static_file(os.path.join('fonts', path)) 
Example #15
Source File: application.py    From apod-api with Apache License 2.0 5 votes vote down vote up
def serve_static(asset_path):
    print(asset_path)
    return current_app.send_static_file(asset_path) 
Example #16
Source File: server.py    From aw-server with Mozilla Public License 2.0 5 votes vote down vote up
def static_root():
    return current_app.send_static_file('index.html')
    return send_from_directory('/', 'index.html')