mirror of
https://github.com/PhoenixTwoFive/karaoqueue.git
synced 2025-05-19 02:51:48 +02:00
Apply Flask deprecation fixes
This commit is contained in:
parent
dcc79aed1b
commit
0db1ef1fc4
@ -169,6 +169,7 @@ def query_songs_with_details(input_string=""):
|
||||
result.append(dict(zip(['karafun_id', 'title', 'artist', 'year', 'duo', 'explicit', 'styles', 'languages'], x)))
|
||||
return jsonify(result)
|
||||
|
||||
|
||||
@app.route("/api/songs/details/<song_id>")
|
||||
def get_song_details(song_id):
|
||||
result = database.get_song_details(song_id)
|
||||
@ -177,6 +178,7 @@ def get_song_details(song_id):
|
||||
else:
|
||||
return jsonify(dict(zip(['karafun_id', 'title', 'artist', 'year', 'duo', 'explicit', 'styles', 'languages'], result[0])))
|
||||
|
||||
|
||||
@app.route("/api/entries/delete/<entry_id>", methods=['GET'])
|
||||
@nocache
|
||||
@basic_auth.required
|
||||
@ -292,17 +294,17 @@ def get_current_event():
|
||||
return Response('{"status": "OK", "event": "' + helpers.get_current_event_id(app) + '"}', mimetype='text/json')
|
||||
|
||||
|
||||
@app.before_first_request
|
||||
def activate_job():
|
||||
helpers.load_dbconfig(app)
|
||||
helpers.load_version(app)
|
||||
database.create_entry_table()
|
||||
database.create_song_table()
|
||||
database.create_done_song_table()
|
||||
database.create_list_view()
|
||||
database.create_done_song_view()
|
||||
database.create_config_table()
|
||||
helpers.setup_config(app)
|
||||
with app.app_context():
|
||||
helpers.load_dbconfig(app)
|
||||
helpers.load_version(app)
|
||||
database.create_entry_table()
|
||||
database.create_song_table()
|
||||
database.create_done_song_table()
|
||||
database.create_list_view()
|
||||
database.create_done_song_view()
|
||||
database.create_config_table()
|
||||
helpers.setup_config(app)
|
||||
|
||||
|
||||
@app.after_request
|
||||
@ -321,5 +323,8 @@ def inject_version():
|
||||
return dict(karaoqueue_version=app.config['VERSION'])
|
||||
|
||||
|
||||
# Perform setup here so it will be executed when the module is imported by the WSGI server.
|
||||
activate_job()
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host='127.0.0.1', port=8080, debug=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user