mirror of
https://github.com/Findus23/nonsense.git
synced 2024-09-19 16:03:50 +02:00
improve flask
This commit is contained in:
parent
1070214bd7
commit
e6ec01a4a4
2 changed files with 9 additions and 9 deletions
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "nonsense",
|
||||
"short_name":"nonsense",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icons/android-chrome-192x192.png",
|
||||
|
|
17
server.py
17
server.py
|
@ -1,9 +1,9 @@
|
|||
from flask import Flask, jsonify, url_for, redirect, abort
|
||||
from flask import Flask, jsonify, abort, send_from_directory
|
||||
|
||||
import generate
|
||||
import ikeagen
|
||||
|
||||
app = Flask(__name__)
|
||||
app = Flask(__name__, static_folder='public/', static_url_path='/')
|
||||
|
||||
|
||||
@app.route('/api/description/<int:count>/')
|
||||
|
@ -17,14 +17,13 @@ def get_description(count):
|
|||
"name": ikeagen.generate()
|
||||
})
|
||||
response = jsonify(descriptions)
|
||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
||||
return response
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def redirect_to_correct_api():
|
||||
return redirect(url_for("get_description", count=10))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host="0.0.0.0")
|
||||
@app.route('/<path:path>')
|
||||
def send_js(path):
|
||||
return send_from_directory('public', path)
|
||||
|
||||
|
||||
app.run()
|
||||
|
|
Loading…
Reference in a new issue