Ejemplo n.º 1
0
Archivo: manage.py Proyecto: ajaxj/fkmv
# !/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:
Ejemplo n.º 2
0
#!/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"
Ejemplo n.º 3
0
# !/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
Ejemplo n.º 4
0
#!/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()
Ejemplo n.º 5
0
#!/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()
Ejemplo n.º 6
0
#__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()
Ejemplo n.º 7
0
#!/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()