move app.py argparse

This commit is contained in:
Bui 2022-03-24 17:44:44 +00:00
parent f45214225b
commit 053f663cbe

15
app.py
View File

@ -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/<path:path>')
def send_src(path):
return send_from_directory('public/src', path)