mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-21 18:31:50 +08:00
move app.py argparse
This commit is contained in:
parent
f45214225b
commit
053f663cbe
15
app.py
15
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/<path:path>')
|
||||
def send_src(path):
|
||||
return send_from_directory('public/src', path)
|
||||
|
Loading…
Reference in New Issue
Block a user