def switch(command, user, is_sudo): try: if command == "init": init_app() elif command == "write": startup_check() write_command(user) elif command == "read": startup_check() read_command() elif command == "share": startup_check() share_command() elif command == "change": startup_check() change_command(user) elif command == "version": version_command() elif command == "help": help_command() elif command == "delete": startup_check() delete_command(user, is_sudo) elif command == "reset": reset_command() else: write_error( "Command not found. For further informations use `servy help`") except KeyboardInterrupt: hide_loading_message_with_error(True, "\n")
from flask import request from init import init_app from models.user import User import logging import json import redis # logging.basicConfig( format= '%(levelname)-8s %(asctime)s,%(msecs)d [%(filename)s:%(lineno)d] %(message)s', datefmt='%Y-%m-%d:%H:%M:%S', level=logging.INFO) # log = logging.getLogger(__name__) app = init_app() # redis_client = redis.Redis(port=6379) # # @app.route('/') def welcome(): log.info('hello world') return "Welcome to cache 101" @app.route('/user', methods=['POST']) def create_user(): data = request.get_json() email = data.get('email')
from init import init_app app = init_app(__name__) @app.route('/') def welcome(): return 'Welcome to Crayon Task' if __name__ == "__main__": app.run(debug=True)
def try_init(message): write_error(message) if input("Do you want to init the app now? Y/N \n") == "Y": init_app() else: exit()
from init import init_app app, db = init_app() import routes if __name__ == "__main__": app.run(debug=True)