1
0
Fork 0
mirror of https://github.com/Findus23/nonsense.git synced 2024-09-19 16:03:50 +02:00

improve flask

This commit is contained in:
Lukas Winkler 2017-12-12 18:51:16 +01:00
parent 1070214bd7
commit e6ec01a4a4
2 changed files with 9 additions and 9 deletions

View file

@ -1,5 +1,6 @@
{
"name": "nonsense",
"short_name":"nonsense",
"icons": [
{
"src": "/icons/android-chrome-192x192.png",

View file

@ -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()