Commits

ronald martinez committed c317824

ok

Comments (0)

Files changed (2)

progress_bar.py

-from pymongo import Connection
-from flask import Flask, jsonify, render_template
-
-cn = Connection()
-db = cn.likes
-app = Flask(__name__)
-app.debug = True
-
-
-@app.route('/get_percent/<post_id>')
-def get_percent(post_id):
-    item = db.progress.find_one(
-        {'post_id': post_id},
-        {'percent'}
-    )
-    value = str(item['percent']) if item else '0'
-    return jsonify(value=value)
-
-
-@app.route('/progress_bar')
-def progress_bar():
-    data = []
-    for x, y in enumerate(db.progress.find()):
-        data.append(dict(
-            n=x,
-            post=y.get('post_id'),
-            percent=y.get('percent')
-        ))
-    return jsonify(data=data)
-
-
-@app.route('/')
-def index():
-    return render_template(
-        'index.html',
-        items=enumerate(db.progress.find())
-    )
-
-
-if __name__ == '__main__':
-    app.run()

supervisord.txt

-celery -A tasks worker -l INFO