python-gallery/run.py

44 lines
1,015 B
Python
Raw Normal View History

2023-03-20 17:19:42 +00:00
"""
Run script for OnlyLegs
"""
from setup.args import PORT, ADDRESS, WORKERS, DEBUG
from setup.configuration import Configuration
2023-03-11 23:16:27 +00:00
print("""
___ _ _
2023-03-23 22:22:52 +00:00
/ _ \\ _ __ | |_ _| | ___ __ _ ___
| | | | '_ \\| | | | | | / _ \\/ _` / __|
| |_| | | | | | |_| | |__| __/ (_| \\__ \\
\\___/|_| |_|_|\\__, |_____\\___|\\__, |___/
2023-03-11 23:16:27 +00:00
|___/ |___/
2023-03-23 13:05:40 +00:00
Created by Fluffy Bean - Version 23.03.23
2023-03-11 23:16:27 +00:00
""")
2023-03-23 22:22:52 +00:00
# Run pre-startup checks and load configuration
Configuration()
2023-03-11 23:16:27 +00:00
if DEBUG:
2023-03-11 23:16:27 +00:00
from gallery import create_app
# If no address is specified, use localhost
if not ADDRESS:
ADDRESS = 'localhost'
create_app().run(host=ADDRESS, port=PORT, debug=True, threaded=True)
2023-03-11 23:16:27 +00:00
else:
2023-03-20 17:19:42 +00:00
from setup.runner import OnlyLegs # pylint: disable=C0412
# If no address is specified, bind the server to all interfaces
if not ADDRESS:
ADDRESS = '0.0.0.0'
2023-03-20 17:19:42 +00:00
options = {
'bind': f'{ADDRESS}:{PORT}',
'workers': WORKERS,
}
2023-03-20 17:19:42 +00:00
OnlyLegs(options).run()