Skip to content

Instantly share code, notes, and snippets.

@dzen
Created September 21, 2014 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dzen/d592365243ec91c9bf18 to your computer and use it in GitHub Desktop.
Save dzen/d592365243ec91c9bf18 to your computer and use it in GitHub Desktop.
Redis and induction sample
import asyncio
import asyncio_redis
from induction import Induction
app = Induction(__name__)
@app.route('/slow')
@asyncio.coroutine
def slow(request, response):
connection = yield from asyncio_redis.Connection.create(host='localhost', port=6379, auto_reconnect=False)
data = yield from connection.get('key')
response.write(
app.render_template("template.html", data=data)
)
app.run()
Jinja2==2.7.3
MarkupSafe==0.23
Routes==2.0
aiohttp==0.9.1
asyncio==3.4.1
asyncio-redis==0.13.4
induction==0.1
repoze.lru==0.6
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<meta name="Keywords" content="" />
<meta name="Description" content="">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<link rel="stylesheet" type="text/css" href="/stdtheme.css" />
<script type="text/javascript">
</script>
</head>
<body>
{{ data }}
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment