af62f8c45a
For quite some time, I hated Falcon's class maps approach that caused more chaos than good for Szurubooru. I've taken a look at the other frameworks (hug, flask, etc) again, but they all looked too bloated/over-engineered. I decided to just talk to WSGI myself. Regex-based routing may not be the fastest in the world, but I'm fine with response time of 10 ms for cached /posts.
26 lines
717 B
Python
Executable file
26 lines
717 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
'''
|
|
Script facade for direct execution with waitress WSGI server.
|
|
Note that szurubooru can be also run using ``python -m szurubooru``, when in
|
|
the repository's root directory.
|
|
'''
|
|
|
|
import argparse
|
|
import os.path
|
|
import sys
|
|
import waitress
|
|
from szurubooru.facade import create_app
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser('Starts szurubooru using waitress.')
|
|
parser.add_argument(
|
|
'-p', '--port', type=int, help='port to listen on', default=6666)
|
|
parser.add_argument('--host', help='IP to listen on', default='0.0.0.0')
|
|
args = parser.parse_args()
|
|
|
|
app = create_app()
|
|
waitress.serve(app, host=args.host, port=args.port)
|
|
|
|
if __name__ == '__main__':
|
|
main()
|