#!/usr/bin/env python # coding: utf-8 from codewow import create_app from codewow.models import Gist, User, Stat from flaskext.script import Server, Shell, Manager, Command, prompt_bool manager = Manager(create_app('dev.cfg')) manager.add_command("runserver", Server('0.0.0.0',port=8080)) @manager.command def stat(): ''' update the stat data command ''' last = Stat.query.descending(Stat.mongo_id).first() if last: gists = Gist.query.filter(Gist.mongo_id.ge_(last.mongo_id)) users = User.query.filter(User.mongo_id.ge_(last.mongo_id)) else: gists = Gist.query users = User.query tag_list = [] tag_set = set() for e in gists: tag_list.extend(e.tags) tag_set.update(e.tags)
# coding: utf-8 from gevent.wsgi import WSGIServer from codewow import create_app app = create_app('production.cfg') http_server = WSGIServer(('127.0.0.1', 8000), app) http_server.serve_forever()
#!/usr/bin/env python # coding: utf-8 from codewow import create_app from codewow.models import Gist, User, Stat from flaskext.script import Server, Shell, Manager, Command, prompt_bool manager = Manager(create_app('dev.cfg')) manager.add_command("runserver", Server('0.0.0.0', port=8080)) @manager.command def stat(): ''' update the stat data command ''' last = Stat.query.descending(Stat.mongo_id).first() if last: gists = Gist.query.filter(Gist.mongo_id.ge_(last.mongo_id)) users = User.query.filter(User.mongo_id.ge_(last.mongo_id)) else: gists = Gist.query users = User.query tag_list = [] tag_set = set() for e in gists: tag_list.extend(e.tags) tag_set.update(e.tags)