示例#1
0
    def test_run(self):
        """
        run function with exception raise
        """
        from wsgi import run
        import modules

        def mock_store(label, subj, body):
            """
            emulate exception raise
            """
            raise Exception(''.join([label, subj, body]))

        saved = modules.store
        modules.store = mock_store

        with self.assertRaises(Exception) as context:
            run('store', 'xxx')
        assert 'xxx' in str(context.exception)

        modules.store = saved
示例#2
0
def main():
    wsgi.run()
示例#3
0
import sys
from wsgi import run
from models import create_model

# python manage.py xx xx2  命令行输入
# 执行py文件时,后面携带的参数,
#可以通过py文件中的sys模块的sys.argv这个属性拿到,
#是个列表,列表第一项是文件名称,第二项之后,都是携带的参数
commands = sys.argv  # xx xx2
# ['manage.py', 'xx', 'oo']

# 运行项目的指令: python manage.py runserver
# 数据库同步指令: python manage.py migrate  建表
a1 = commands[1]
if a1 == 'runserver':
    run()
elif a1 == 'migrate':
    create_model()
示例#4
0
文件: manage.py 项目: rhlobo/ngFlask
def run():
	wsgi.run()