# !/usr/bin/env python # coding: utf-8 import uuid from flask.ext.script import Server,Shell,Manager, prompt_bool from pypress import create_app from pypress.extensions import db from pypress.models.users import User,UserCode manager = Manager(create_app("config.cfg")) manager.add_command("runserver",Server('0.0.0.0',port=8080)) def _make_context(): return dict(db=db) manager.add_command("shell",Shell(make_context=_make_context)) @manager.command def createall(): db.create_all() @manager.command def dropall(): if prompt_bool("Are you sure? You will lose all your data!"): db.drop_all() # python manage.py hello -n Joe -u reddit.com #python manage.py hello --name=Joe --url=reddit.com @manager.option('-n', '--name', dest='name', default='joe') @manager.option('-u', '--url', dest='url', default=None) def hello(name, url): if url is None:
#!/usr/bin/env python # coding=utf-8 import uuid from flask_script import Server, Shell, Manager, prompt_bool from pypress import create_app from pypress.extensions import db from pypress.models.users import User, UserCode manager = Manager(create_app('config.cfg')) manager.add_command("runserver", Server('0.0.0.0', port=8080)) def _make_context(): return dict(db=db) manager.add_command("shell", Shell(make_context=_make_context)) @manager.command def createall(): "Creates database tables" db.create_all() @manager.command def dropall(): "Drops all database tables"
# !/usr/bin/env python # coding: utf-8 import uuid from flask.ext.script import Server, Shell, Manager, prompt_bool from pypress import create_app from pypress.extensions import db from pypress.models.users import User, UserCode manager = Manager(create_app("config.cfg")) manager.add_command("runserver", Server('0.0.0.0', port=8080)) def _make_context(): return dict(db=db) manager.add_command("shell", Shell(make_context=_make_context)) @manager.command def createall(): db.create_all() @manager.command def dropall(): if prompt_bool("Are you sure? You will lose all your data!"): db.drop_all() # python manage.py hello -n Joe -u reddit.com
#!/usr/bin/env python from pypress import create_app from flup.server.fcgi import WSGIServer app = create_app("config.cfg") WSGIServer(app, bindAddress="/tmp/pypress.sock").run()
#!/usr/bin/env python #coding=utf-8 import uuid from flask import Flask, current_app from flaskext.script import Server, Shell, Manager, Command, prompt_bool from pypress import create_app from pypress.extensions import db from pypress.models.users import User, UserCode manager = Manager(create_app('config.cfg')) manager.add_command("runserver", Server('0.0.0.0',port=8080)) def _make_context(): return dict(db=db) manager.add_command("shell", Shell(make_context=_make_context)) @manager.command def createall(): "Creates database tables" db.create_all() @manager.command def dropall(): "Drops all database tables" if prompt_bool("Are you sure ? You will lose all your data !"): db.drop_all()
#__author__ = 'zhangxiaodong' from pypress import create_app app = create_app('config.cfg') from flup.server.fcgi import WSGIServer WSGIServer(app,bindAddress='/tmp/pypress.sock').run()
#!/usr/bin/env python from pypress import create_app app = create_app('config.cfg') from flup.server.fcgi import WSGIServer WSGIServer(app, bindAddress='/tmp/pypress.sock').run()