404 error for flask api.

This commit is contained in:
Michael Zhang 2016-03-12 15:46:38 -06:00
parent dae7aec24e
commit a5298ecff9
3 changed files with 7 additions and 3 deletions

View file

@ -7,7 +7,7 @@ server {
index index.html index.htm;
server_name localhost;
error_page 404 /404;
error_page 404 /index.html;
# location / {
# try_files $uri $uri/ =404;

View file

@ -1,4 +1,4 @@
from flask import Blueprint, make_response, session, request, redirect, url_for, send_file
from flask import Blueprint, make_response, session, request, redirect, url_for, send_file, abort
from werkzeug import secure_filename
from flask import current_app as app
from voluptuous import Schema, Length, Required

View file

@ -1,7 +1,7 @@
#!/usr/bin/python
from argparse import ArgumentParser
from flask import Flask
from flask import Flask, send_file
app = Flask(__name__)
@ -40,6 +40,10 @@ api.logger.initialize_logs()
def api_main():
return { "success": 1, "message": "The API is online." }
@app.errorhandler(404)
def page_not_found(e):
return send_file("../web/index.html")
def run(args):
with app.app_context():
keyword_args = dict(args._get_kwargs())