From 053f663cbeb5a4a12e99264cd86729f11fb82a06 Mon Sep 17 00:00:00 2001 From: Bui Date: Thu, 24 Mar 2022 17:44:44 +0000 Subject: [PATCH] move app.py argparse --- app.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index a899b68..d547ba5 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -import argparse import base64 import bcrypt import hashlib @@ -24,12 +23,6 @@ from ffmpy import FFmpeg from pymongo import MongoClient from redis import Redis -parser = argparse.ArgumentParser(description='Run the taiko-web development server.') -parser.add_argument('port', type=int, metavar='PORT', nargs='?', default=34801, help='Port to listen on.') -parser.add_argument('-b', '--bind-address', default='localhost', help='Bind server to address.') -parser.add_argument('-d', '--debug', action='store_true', help='Enable debug mode.') -args = parser.parse_args() - def take_config(name, required=False): if hasattr(config, name): return getattr(config, name) @@ -715,7 +708,15 @@ def make_preview(song_id, song_type, song_ext, preview): if __name__ == '__main__': + import argparse from flask import send_from_directory + + parser = argparse.ArgumentParser(description='Run the taiko-web development server.') + parser.add_argument('port', type=int, metavar='PORT', nargs='?', default=34801, help='Port to listen on.') + parser.add_argument('-b', '--bind-address', default='localhost', help='Bind server to address.') + parser.add_argument('-d', '--debug', action='store_true', help='Enable debug mode.') + args = parser.parse_args() + @app.route('/src/') def send_src(path): return send_from_directory('public/src', path)