def index(request_method): _check_method('GET', request_method) return ok, {'version': get_version()}
help="The db within Redis to use.") parser.add_option( "-H", "--host", dest="host", default='127.0.0.1', help= "Choose the host IP/domain name to run the service on. Default: '127.0.0.1'" ) parser.add_option( "-p", "--port", dest="port", type="int", default=8008, help="Choose the port to run the service on. Default: 8008") (options, args) = parser.parse_args() # Set up the DB. setup(options) # Start handling requests. print("Welcome to FriendlyDB (v{0})!".format(get_version())) print("Serving on http://{0}:{1}...".format(options.host, options.port)) server = pywsgi.WSGIServer((options.host, options.port), application) try: server.serve_forever() except KeyboardInterrupt: print("Shutting down. Have a nice day!")
return resp_func(env, start_response, body) # Nothing matched. 404'd! return not_found(env, start_response) if __name__ == '__main__': from optparse import OptionParser import sys parser = OptionParser() parser.add_option("-d", "--data", dest="data_directory", help="The directory to store the data in.") parser.add_option("-w", "--width", dest="hash_width", type="int", default=None, help="Defines the width of the hashes.") parser.add_option("-H", "--host", dest="host", default='127.0.0.1', help="Choose the host IP/domain name to run the service on. Default: '127.0.0.1'") parser.add_option("-p", "--port", dest="port", type="int", default=8008, help="Choose the port to run the service on. Default: 8008") (options, args) = parser.parse_args() # Set up the DB. setup(options) # Start handling requests. print "Welcome to FriendlyDB (v%s)!" % get_version() print "Serving on http://%s:%s..." % (options.host, options.port) server = pywsgi.WSGIServer((options.host, options.port), application) try: server.serve_forever() except KeyboardInterrupt: print "Shutting down. Have a nice day!"
return resp_func(env, start_response, body) # Nothing matched. 404'd! return not_found(env, start_response) if __name__ == '__main__': from optparse import OptionParser parser = OptionParser() parser.add_option("--redis_host", dest="redis_host", default='localhost', help="The hostname Redis is running on.") parser.add_option("--redis_port", dest="redis_port", type="int", default=6379, help="The port Redis is running on.") parser.add_option("--redis_db", dest="redis_db", type="int", default=0, help="The db within Redis to use.") parser.add_option("-H", "--host", dest="host", default='127.0.0.1', help="Choose the host IP/domain name to run the service on. Default: '127.0.0.1'") parser.add_option("-p", "--port", dest="port", type="int", default=8008, help="Choose the port to run the service on. Default: 8008") (options, args) = parser.parse_args() # Set up the DB. setup(options) # Start handling requests. print("Welcome to FriendlyDB (v{0})!".format(get_version())) print("Serving on http://{0}:{1}...".format(options.host, options.port)) server = pywsgi.WSGIServer((options.host, options.port), application) try: server.serve_forever() except KeyboardInterrupt: print("Shutting down. Have a nice day!")