Update app.py
Browse files
app.py
CHANGED
@@ -214,34 +214,14 @@ def get_args():
|
|
214 |
args.url_prefix = '/' + args.url_prefix
|
215 |
return args
|
216 |
|
217 |
-
|
218 |
def main():
|
219 |
args = get_args()
|
220 |
app = create_app(args)
|
221 |
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
# '::' will listen on both ipv6 and ipv4
|
227 |
-
args.host = "::"
|
228 |
-
|
229 |
-
if args.debug:
|
230 |
-
app.run(host=args.host, port=args.port)
|
231 |
-
else:
|
232 |
-
from waitress import serve
|
233 |
-
|
234 |
-
url_scheme = "https" if args.ssl else "http"
|
235 |
-
print(f"Running on {url_scheme}://{args.host}:{args.port}{args.url_prefix}")
|
236 |
-
|
237 |
-
serve(
|
238 |
-
app,
|
239 |
-
host=args.host,
|
240 |
-
port=args.port,
|
241 |
-
url_scheme=url_scheme,
|
242 |
-
threads=args.threads
|
243 |
-
)
|
244 |
-
|
245 |
|
246 |
if __name__ == "__main__":
|
247 |
main()
|
|
|
214 |
args.url_prefix = '/' + args.url_prefix
|
215 |
return args
|
216 |
|
|
|
217 |
def main():
|
218 |
args = get_args()
|
219 |
app = create_app(args)
|
220 |
|
221 |
+
# No need to check for '--wsgi' or sys.argv here
|
222 |
+
# Directly run the app using a WSGI server
|
223 |
+
from waitress import serve
|
224 |
+
serve(app, host=args.host, port=args.port)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
|
226 |
if __name__ == "__main__":
|
227 |
main()
|