1
0
mirror of https://github.com/enpaul/kodak.git synced 2024-11-15 02:57:00 +00:00
kodak/imagemuck/__main__.py

44 lines
1.3 KiB
Python
Raw Normal View History

2020-12-22 02:08:38 +00:00
"""Development server stub entrypoint
2021-05-05 17:48:02 +00:00
Flask comes with a built-in development server. This entrypoint allows ``imagemuck``
2020-12-22 02:08:38 +00:00
to be run directly to run the development server and expose some simple config options for ease of
access. Run the below command to start the server:
::
2021-05-05 17:48:02 +00:00
python -m imagemuck
2020-12-22 02:08:38 +00:00
In addition to the helpful CLI flags, the Flask development server run by this module will also
load any ``.env`` files in the current working directory when running the application.
.. warning:: As the development server will tell you on startup, do not use this for production
deployments.
"""
import argparse
import sys
2021-05-05 17:48:02 +00:00
from imagemuck.application import APPLICATION
2020-12-22 02:08:38 +00:00
# pylint: disable=invalid-name
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"-b",
"--bind",
help="Address or socket to bind the server to",
default="127.0.0.1",
)
parser.add_argument(
"-p", "--port", help="Port bind the server to", default=5000, type=int
)
parser.add_argument(
"-D", "--debug", help="Run Flask in debug mode", action="store_true"
)
args = parser.parse_args()
APPLICATION.run(host=args.bind, port=args.port, debug=args.debug, load_dotenv=True)
if __name__ == "__main__":
sys.exit(main())