FAQ
Hi,

I am writing a small tornado app using python, below is my code, I have a form
with 2 text boxes, now I want to save the data thats entered into these 2 boxes
into redis as a key value pair. Firs thing, I want to knwo how to make the
connection to redis and write the data to it. Any help with code example will be
highly appreciated.

My tornado app which needs to save info to redis through 2 text fields.

import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web

from tornado.options import define, options

define("port", default=8888, help="run on the given port", type=int)

class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write('<html><body><form action="/" method="post">'
'<p>Please enter the Key Value pair for redis.</p>'
'<input type="text" name="key" value="type key here">'
'<input type="text" name="value" value="type value here">'
'<input type="submit" value="Submit Key Value">'
'</form></body></html>')

def main():
tornado.options.parse_command_line()
application = tornado.web.Application([
(r"/", MainHandler),
])
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()


if __name__ == "__main__":
main()




--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redis-db@googlegroups.com.
To unsubscribe from this group, send email to redis-db+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.

Search Discussions

  • Josiah Carlson at Mar 16, 2012 at 9:49 pm
    This post may give you some more information:
    https://groups.google.com/forum/?fromgroups#!topic/redis-db/Aav8n-VLvzs

    Regards,
    - Josiah
    On Fri, Mar 16, 2012 at 1:44 PM, sup wrote:
    Hi,

    I am writing a small tornado app using python, below is my code, I have a form
    with 2 text boxes, now I want to save the data thats entered into these 2 boxes
    into redis as a key value pair. Firs thing, I want to knwo how to make the
    connection to redis and write the data to it. Any help with code example will be
    highly appreciated.

    My tornado app which needs to save info to redis through 2 text fields.

    import tornado.httpserver
    import tornado.ioloop
    import tornado.options
    import tornado.web

    from tornado.options import define, options

    define("port", default=8888, help="run on the given port", type=int)

    class MainHandler(tornado.web.RequestHandler):
    def get(self):
    self.write('<html><body><form action="/" method="post">'
    '<p>Please enter the Key Value pair for redis.</p>'
    '<input type="text" name="key" value="type key here">'
    '<input type="text" name="value" value="type value here">'
    '<input type="submit" value="Submit Key Value">'
    '</form></body></html>')

    def main():
    tornado.options.parse_command_line()
    application = tornado.web.Application([
    (r"/", MainHandler),
    ])
    http_server = tornado.httpserver.HTTPServer(application)
    http_server.listen(options.port)
    tornado.ioloop.IOLoop.instance().start()


    if __name__ == "__main__":
    main()




    --
    You received this message because you are subscribed to the Google Groups "Redis DB" group.
    To post to this group, send email to redis-db@googlegroups.com.
    To unsubscribe from this group, send email to redis-db+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Redis DB" group.
    To post to this group, send email to redis-db@googlegroups.com.
    To unsubscribe from this group, send email to redis-db+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
  • Dvir Volk at Mar 16, 2012 at 10:14 pm
    this is a cross post from
    http://stackoverflow.com/questions/9745056/how-to-save-user-input-data-to-redis-using-tornado-python

    On Fri, Mar 16, 2012 at 11:49 PM, Josiah Carlson
    wrote:
    This post may give you some more information:
    https://groups.google.com/forum/?fromgroups#!topic/redis-db/Aav8n-VLvzs

    Regards,
    - Josiah
    On Fri, Mar 16, 2012 at 1:44 PM, sup wrote:
    Hi,

    I am writing a small tornado app using python, below is my code, I have a form
    with 2 text boxes, now I want to save the data thats entered into these 2 boxes
    into redis as a key value pair. Firs thing, I want to knwo how to make the
    connection to redis and write the data to it. Any help with code example will be
    highly appreciated.

    My tornado app which needs to save info to redis through 2 text fields.

    import tornado.httpserver
    import tornado.ioloop
    import tornado.options
    import tornado.web

    from tornado.options import define, options

    define("port", default=8888, help="run on the given port", type=int)

    class MainHandler(tornado.web.RequestHandler):
    def get(self):
    self.write('<html><body><form action="/" method="post">'
    '<p>Please enter the Key Value pair for redis.</p>'
    '<input type="text" name="key" value="type key here">'
    '<input type="text" name="value" value="type value here">'
    '<input type="submit" value="Submit Key Value">'
    '</form></body></html>')

    def main():
    tornado.options.parse_command_line()
    application = tornado.web.Application([
    (r"/", MainHandler),
    ])
    http_server = tornado.httpserver.HTTPServer(application)
    http_server.listen(options.port)
    tornado.ioloop.IOLoop.instance().start()


    if __name__ == "__main__":
    main()




    --
    You received this message because you are subscribed to the Google
    Groups "Redis DB" group.
    To post to this group, send email to redis-db@googlegroups.com.
    To unsubscribe from this group, send email to
    redis-db+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/redis-db?hl=en.
    --
    You received this message because you are subscribed to the Google Groups
    "Redis DB" group.
    To post to this group, send email to redis-db@googlegroups.com.
    To unsubscribe from this group, send email to
    redis-db+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/redis-db?hl=en.

    --
    Dvir Volk
    System Architect, The Everything Project (formerly DoAT)
    http://everything.me

    --
    You received this message because you are subscribed to the Google Groups "Redis DB" group.
    To post to this group, send email to redis-db@googlegroups.com.
    To unsubscribe from this group, send email to redis-db+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupredis-db @
categoriesredis
postedMar 16, '12 at 8:50p
activeMar 16, '12 at 10:14p
posts3
users3
websiteredis.io
irc#redis

3 users in discussion

Sup: 1 post Dvir Volk: 1 post Josiah Carlson: 1 post

People

Translate

site design / logo © 2022 Grokbase