python - Flask app won't load in browser -


i'm getting started flask , i'm trying build tutorial micro-blog using redis. here app:

from flask import flask, render_template, request, url_for, redirect import redis datetime import datetime  app = flask(__name__) app.config.from_object(__name__)  app.config.update(dict(     debug = true,     ))  pool = redis.connectionpool(host='localhost', port=6379, db=0)  @app.route("/") def index():     r = redis.strictredis(connection_pool = pool)     print r     pipe = r.pipeline()     print pipe     last_ten = pipe.zrange('post:created_on', 0, 9)     print last_ten     posts = []     post in last_ten:         posts.append(pipe.hgetall('{}{}'.format('post:', post)))       print posts     pipe.execute()      return render_template('index.html', posts)    @app.route('/new', methods = ['post']) def addpost():     r = redis.strictredis(connection_pool = pool)      title = request.form['title']     author = request.form['author']     = datetime.now()      pipe = r.pipeline()     post_format = 'post:'     pid = pipe.incr('post')     pipe.hmset('{}{}'.format(post_format,pid), {'title':title, 'author':author})     pipe.zadd('post:created_on', pid = now)     pipe.execute()      return redirect(url_for('index'))  if __name__ == "__main__":     app.run() 

when run python testapp.py get

* running on http://127.0.0.1:5000/ * restarting reloader 

however page never loads @ http://127.0.0.1:5000/ nor return error. hangs, trying load forever. i've left while , keeps on going. i'm not sure causing thank help.

update: have added several print statements in index view see happening while code runs , printed terminal.

* running on http://127.0.0.1:5000/ * restarting reloader strictredis<connectionpool<connection<host=localhost,port=6379,db=0>>> strictpipeline<connectionpool<connection<host=localhost,port=6379,db=0>>> strictpipeline<connectionpool<connection<host=localhost,port=6379,db=0>>> 

i believe have solved issue. problem opened pipeline , tried acting on data retrieved db before had called pipe.execute. i'm still working on getting overall function work how solved particular issue.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -