2023-09-26 20:00:26 +00:00
|
|
|
# pylint: disable=multiple-statements,wrong-import-position,wrong-import-order
|
|
|
|
from gevent.monkey import patch_all; patch_all()
|
|
|
|
from gevent.pywsgi import WSGIServer
|
|
|
|
|
|
|
|
from app import Application
|
|
|
|
from routes import routes
|
2023-10-01 17:47:35 +00:00
|
|
|
from routes.requests import routes_requests
|
|
|
|
from config.server_settings import ServerSettings
|
2023-09-26 20:00:26 +00:00
|
|
|
|
|
|
|
instance = Application.get_instance()
|
2023-10-01 19:40:06 +00:00
|
|
|
app, api = instance.app, instance.api
|
2023-09-26 20:00:26 +00:00
|
|
|
api.register_blueprint(routes)
|
2023-10-01 17:47:35 +00:00
|
|
|
api.register_blueprint(routes_requests)
|
2023-09-26 20:00:26 +00:00
|
|
|
|
2023-10-01 17:47:35 +00:00
|
|
|
HOSTNAME = ServerSettings.HOSTNAME
|
|
|
|
PORT = ServerSettings.PORT
|
2023-09-26 20:00:26 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2023-10-01 17:47:35 +00:00
|
|
|
http_Server = WSGIServer((HOSTNAME, PORT), app)
|
2023-09-26 20:00:26 +00:00
|
|
|
try:
|
2023-10-01 17:47:35 +00:00
|
|
|
print(f"Server available on http://{HOSTNAME}:{PORT}/")
|
|
|
|
print(f"View docs on http://{HOSTNAME}:{PORT}/swagger")
|
2023-09-26 20:00:26 +00:00
|
|
|
http_Server.serve_forever()
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
print("Keyboard interrupt received, stopping...")
|