404 error for flask api.
This commit is contained in:
parent
dae7aec24e
commit
a5298ecff9
3 changed files with 7 additions and 3 deletions
|
@ -7,7 +7,7 @@ server {
|
||||||
index index.html index.htm;
|
index index.html index.htm;
|
||||||
|
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
error_page 404 /404;
|
error_page 404 /index.html;
|
||||||
|
|
||||||
# location / {
|
# location / {
|
||||||
# try_files $uri $uri/ =404;
|
# try_files $uri $uri/ =404;
|
||||||
|
|
|
@ -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 werkzeug import secure_filename
|
||||||
from flask import current_app as app
|
from flask import current_app as app
|
||||||
from voluptuous import Schema, Length, Required
|
from voluptuous import Schema, Length, Required
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from flask import Flask
|
from flask import Flask, send_file
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@ -40,6 +40,10 @@ api.logger.initialize_logs()
|
||||||
def api_main():
|
def api_main():
|
||||||
return { "success": 1, "message": "The API is online." }
|
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):
|
def run(args):
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
keyword_args = dict(args._get_kwargs())
|
keyword_args = dict(args._get_kwargs())
|
||||||
|
|
Loading…
Add table
Reference in a new issue