Created
March 22, 2015 16:51
-
-
Save juliedavila/8f689a6694e5407333c4 to your computer and use it in GitHub Desktop.
For interactive how-to blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2014, Matt Makai | |
# All rights reserved. | |
# Full License can be read here: http://bit.ly/1qBgqzn | |
from gevent import monkey | |
monkey.patch_all() | |
import os | |
import redis | |
from presentation import app, redis_db, socketio | |
from flask.ext.script import Manager, Shell | |
manager = Manager(app) | |
def make_shell_context(): | |
return dict(app=app, redis_db=redis_db) | |
manager.add_command("shell", Shell(make_context=make_shell_context)) | |
@manager.command | |
def runserver(): | |
socketio.run(app, "0.0.0.0", port=5001) | |
@manager.command | |
def clear_redis(): | |
redis_cli = redis.StrictRedis(host=REDIS_SERVER, port=REDIS_PORT, db=REDIS_DB) | |
redis_cli.delete('noob') | |
redis_cli.delete('some') | |
redis_cli.delete('great') | |
if __name__ == '__main__': | |
manager.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment