def run(self): args = arg_parser.parse_args() if args.server is not None: print("Running as api server instance.") return api.run() else: stylesheet = self.get_resource('styles.qss') self.app.setStyleSheet(open(stylesheet).read()) self.window.show() return self.app.exec_()
from server import api from server.controller import IndexCreateTodo, DeleteTodo def routes(): api.add_route('/', static=True) api.add_route('/api/todos', IndexCreateTodo) api.add_route('/api/todos/{id}', DeleteTodo) if __name__ == '__main__': routes() api.run()
def main(): port = int(os.environ.get("PORT", 5000)) api.run(host='0.0.0.0', port=port)
from server import api from server.models import Base, engine if __name__ == "__main__": api.run(address='0.0.0.0', port=80)
from server import api, routes if __name__ == '__main__': api.debug = False api.run(host=api.config.get('FLASK_HOST'), port=5005)