mirror of
https://github.com/yuukiwww/taiko-web.git
synced 2024-10-22 17:05:49 +02: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
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import argparse
|
|
||||||
import base64
|
import base64
|
||||||
import bcrypt
|
import bcrypt
|
||||||
import hashlib
|
import hashlib
|
||||||
@ -24,12 +23,6 @@ from ffmpy import FFmpeg
|
|||||||
from pymongo import MongoClient
|
from pymongo import MongoClient
|
||||||
from redis import Redis
|
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):
|
def take_config(name, required=False):
|
||||||
if hasattr(config, name):
|
if hasattr(config, name):
|
||||||
return getattr(config, name)
|
return getattr(config, name)
|
||||||
@ -715,7 +708,15 @@ def make_preview(song_id, song_type, song_ext, preview):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
import argparse
|
||||||
from flask import send_from_directory
|
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>')
|
@app.route('/src/<path:path>')
|
||||||
def send_src(path):
|
def send_src(path):
|
||||||
return send_from_directory('public/src', path)
|
return send_from_directory('public/src', path)
|
||||||
|
Loading…
Reference in New Issue
Block a user