예제 #1
0
파일: manage.py 프로젝트: chao-yuan-cy/hmsc
from application import app, manager
from flask_script import Server
import urls
#配置runserver指令

manager.add_command(
    'runserver',
    Server(host='localhost', port='5000', use_debugger=True,
           use_reloader=True))


def main():
    manager.run()


if __name__ == '__main__':
    try:
        import sys
        sys.exit(main())
    except Exception as e:
        import traceback
        traceback.print_exc()
예제 #2
0
#!/usr/bin/env python3
# _*_ coding:utf-8 _*_
# author: hyatt
# CreateDateTime: 2019/5/1 16:22
# FileName: manager.py
# Email: [email protected]
from application import app, manager
from flask_script import Server
"""
程序启动管理器,工厂函数创建APP
"""

manager.add_command(
    "runserver",
    Server(host="0.0.0.0", port=8999, use_debugger=True, use_reloader=True))


def main():
    manager.run()


if __name__ == '__main__':
    try:
        import sys
        sys.exit(main())
    except Exception as e:
        import traceback
        traceback.print_exc()
예제 #3
0
# _*_ coding: utf-8 _*_

from application import app, manager
from flask_script import Server
import www

#web server
manager.add_command(
    "runserver",
    Server(host='0.0.0.0',
           port=app.config['SERVER_PORT'],
           use_debugger=True,
           use_reloader=True))


def main():
    manager.run()


if __name__ == '__main__':
    try:
        import sys
        sys.exit(main())
    except Exception as e:
        import traceback
        traceback.print_exc()
예제 #4
0
from _datetime import datetime
from flask_script import Server, Command
from application import app, manager
from web.www import *

'''
flask_script: 官网 https://flask-script.readthedocs.io/en/latest/
1. manager.add_command() 不能为空字符串
2. 三种方式添加命令
'''

'''
================== 第一种
'''
manager.add_command("runserver",
                    Server(host="localhost", port=app.config['SERVER_PORT'], use_debugger=app.config['DEBUG'],
                           use_reloader=True))

'''
================== 第二种
'''


@manager.command
def hello():
    print("hello world!")


'''
================== 第三种
'''
예제 #5
0
파일: manage.py 프로젝트: why19970628/order
from application import app, manager, db
from application import app, manager
from flask_script import Server
from jobs.launcher import runjob
from flask_migrate import Migrate, MigrateCommand
import www

# database migrate comand
"""
    python manage.py db init
    python manage.py db migrate
    python manage.py db upgrade
"""
Migrate(app, db)
manager.add_command('db', MigrateCommand)

# web server
manager.add_command(
    'runserver',
    Server(
        # host='0.0.0.0',
        port=app.config['SERVER_PORT'],
        use_debugger=True))
# job entrance
manager.add_command('runjob', runjob())


def main():
    manager.run()

예제 #6
0
from application import app, manager
from flask_script import Server
import www
from jobs.launcher import runJob

#web server
manager.add_command(
    "runserver",
    Server(port=app.config["SERVER_PORT"],
           use_debugger=True,
           use_reloader=True,
           threaded=True))
#job entrance
manager.add_command('runjob', runJob())


def main():
    #app.run(host="0.0.0.0",debug=True)
    manager.run()


if __name__ == "__main__":
    try:
        import sys
        sys.exit(main())
    except Exception as e:
        import traceback
        traceback.print_exc()
예제 #7
0
파일: manager.py 프로젝트: lwj-wq/hmsx
from application import app,manager
from flask_script import Server
import urls

# web 服务器
manager.add_command( "runserver",Server(host="localhost",port=5000,use_debugger=True,use_reloader=True) )

def main():
    manager.run()

if __name__ == "__main__":
    try:
        import sys
        sys.exit(main())
    except Exception as e:
        import traceback
        traceback.print_exc()
예제 #8
0
from application import app, manager
from flask_script import Server
from jobs.launcher import runJob
import www

# web server
manager.add_command(
    "runserver",
    Server(
        host="0.0.0.0",
        port=app.config['SERVER_PORT'],
        use_debugger=True,
    ))

# job entrance
manager.add_command("runjob", runJob())


def main():
    manager.run()


if __name__ == '__main__':
    try:
        import sys
        sys.exit(main())  # 0正常退出,其他不正常退出捕获异常
    except Exception as e:
        import traceback  # 捕获异常那个文件哪一行
        traceback.print_exc()
예제 #9
0
# -*- coding: utf-8 -*-

import www
from application import app, manager
from flask_script import Server
from jobs.launcher import runJob
from test.launcher import runTest

# run web server
manager.add_command( "runserver", Server( host='0.0.0.0',port=app.config['SERVER_PORT'],use_debugger = app.config['DEBUG'] ,use_reloader = True) )

# run job task
manager.add_command('runjob', runJob() )

# run test case
manager.add_command( 'runtest', runTest() )

def main():
    manager.run( )

if __name__ == '__main__':
    try:
        import sys
        sys.exit( main() )
    except Exception as e:
        import traceback
        traceback.print_exc()
예제 #10
0
파일: manager.py 프로젝트: whisnos/weix
from flask_migrate import Migrate, MigrateCommand

from application import app, manager
from flask_script import Server
import www
# 需要引入所有变量

# 可自定义命令
from common.models import db

manager.add_command('run', Server(host='0.0.0.0', port=app.config['SERVER_PORT'], use_debugger=True,use_reloader = True))
migrate = Migrate(app, db)

manager.add_command('db', MigrateCommand)


def main():
    manager.run()


if __name__ == '__main__':
    try:
        import sys

        sys.exit(main())
    except Exception as e:
        import traceback

        traceback.print_exc()
예제 #11
0
# -*- coding: utf-8 -*-
from application import app,manager
from flask_script import Server
from flask_assets import ManageAssets
from jobs.launcher import runJob
from www import *

##web server
manager.add_command('runserver', Server(host='0.0.0.0', port=app.config.get('SERVER_PORT'), use_debugger=True))

#job entrance
manager.add_command('runjob', runJob() )

def main():
    manager.run()

if __name__ == '__main__':
    try:
        import sys
        sys.exit( main() )
    except Exception as e:
        app.logger.info( e )

__all__ = []
예제 #12
0
# 启动文件

from application import app, manager
from flask_script import Server, Command
from www import *

# web server
manager.add_command(
    "runserver", Server(host='localhost', use_debugger=True,
                        use_reloader=True))


# create table
@Command
def create_all():
    from application import db
    from common.models.user import User
    db.create_all()


manager.add_command("createall", create_all)


def main():
    manager.run()


if __name__ == "__main__":
    # app.run(host='localhost',debug=True)
    try:
        import sys
예제 #13
0
import os
from flask_migrate import Migrate, MigrateCommand
from flask_script import Server

import www
from application import app, db, manager
# 导入模型
from common.models import User
from common.models.log import AppLog

## manager cmd
Migrate(app, db)
manager.add_command('runserver',
                    Server(host='127.0.0.1', port=app.config['SERVER_PORT']),
                    use_debug=True)
manager.add_command('db', MigrateCommand)


def main():
    manager.run()


if __name__ == "__main__":
    try:
        import sys
        sys.exit(main())
    except Exception as e:
        import traceback
        traceback.print_exc()
예제 #14
0
from application import app, manager
from flask_script import Server
from jobs.launcher import runJob
import www
##web server
manager.add_command("runserver", Server(use_debugger=True, use_reloader=True))

#job entrance
manager.add_command("runjob", runJob())


def main():
    manager.run()


if __name__ == "__main__":
    try:
        import sys
        sys.exit(main())
        pass
    except Exception as e:
        import traceback
        traceback.print_exc()
예제 #15
0
from application import app, manager
# 引入入口文件
import www

from flask_script import Server

# web Server
manager.add_command("runserver", Server(port=5000))


def main():
    app.run(debug=True)


if __name__ == '__main__':
    try:
        import sys

        sys.exit(main())
    except Exception as e:
        import traceback

        traceback.print_exc()
예제 #16
0
# -*- coding:utf-8 -*-
#@Auhor : Agam
#@Time  : 2018-12-08
#@Email : [email protected]

from application import app, manager
from flask_script import Server

import www

manager.add_command(
    "runserver",
    Server(host="127.0.0.1", port=app.config['SERVER_PORT'],
           use_debugger=True))


def main():
    manager.run()


if __name__ == '__main__':
    try:
        import sys
        sys.exit(main())

    except Exception as e:
        import traceback

        traceback.print_exc()
예제 #17
0
파일: manager.py 프로젝트: hqhiwqy/AI-2
from application import app, db, manager
from flask_script import Server
from flask_migrate import Migrate, MigrateCommand
import traceback
import www

migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
manager.add_command(
    'runserver',
    Server(host='0.0.0.0',
           port=app.config['SERVER_PORT'],
           use_debugger=app.config['DEBUG']))

if __name__ == "__main__":
    try:
        manager.run()
    except Exception as err:
        traceback.print_exc(err)
예제 #18
0
#encoding:utf-8
from application import app, manager
from flask_script import Server

# 自定义命令
manager.add_command(
    'runserver',
    Server(host='0.0.0.0',
           port=app.config["SERVER_PORT"],
           use_debugger=True,
           use_reloader=True))


def main():
    manager.run()


if __name__ == '__main__':
    try:
        import sys
        sys.exit(main())

    except Exception as e:
        # 返回错误
        import traceback
        traceback.print_exc()
예제 #19
0
from application import app, manager
from flask_script import Server
import sys, www

manager.add_command("runserver", Server(host='0.0.0.0', port=8999, use_debugger=app.config['DEBUG'],
                                        use_reloader=True))


def main():
    manager.run()


if __name__ == '__main__':
    try:
        sys.exit(main())
    except Exception as e:
        import traceback
        traceback.print_exc()
# -*- coding: utf-8 -*-
from application import app, manager

from jobs.launcher import runJob, jobList

#job entrance
manager.add_command('runjob', runJob())
manager.add_command('joblist', jobList())


def main():

    manager.run()


if __name__ == '__main__':
    try:
        import sys
        sys.exit(main())
    except Exception as e:
        app.logger.info(e)
예제 #21
0
# -*- coding: utf-8 -*-
from application import app, manager
from flask_script import Server
import www
from jobs.launcher import runJob

##web server
manager.add_command(
    "runserver",
    Server(host=app.config['SERVER_HOST'],
           port=app.config['SERVER_PORT'],
           use_debugger=False,
           use_reloader=True))

# job entrance
manager.add_command('runjob', runJob())


def main():
    manager.run()


if __name__ == '__main__':
    try:
        import sys

        sys.exit(main())
    except Exception as e:
        import traceback

        traceback.print_exc()
예제 #22
0
import www
from application import manager, app
from flask_script import Server

manager.add_command(
    'runserver',
    Server(host=app.config['SERVER_HOST'],
           port=app.config['SERVER_PORT'],
           use_debugger=app.config['DEBUG'],
           use_reloader=True))


def main():
    manager.run()


if __name__ == '__main__':
    try:
        import sys

        sys.exit(main())
    except Exception as e:
        import traceback

        traceback.print_exc()
예제 #23
0
from application import app, Base, ENGINE, manager
from flask_script import Server, Command
from www import *

from apscheduler_img import Map_update

# web server
manager.add_command(
    "runserver", Server(host="0.0.0.0", use_debugger=True, use_reloader=True))

map = Map_update()
map.sche_set(10)
map.sche_start()


# create tables
@Command
def create_all():
    from common.models.cloud import Cloud

    Base.metadata.create_all(bind=ENGINE)


manager.add_command("create_all", create_all)


def main():
    manager.run()


if __name__ == "__main__":
예제 #24
0
from application import app, manager
from flask_script import Server
import www

manager.add_command(
    "runserver",
    Server(host=app.config['SERVER_HOST'], port=app.config['SERVER_PORT']))


def main():
    # app.run(host="0.0.0.0", debug=True)
    manager.run()


if __name__ == '__main__':
    try:
        import sys
        sys.exit(main())
    except Exception as e:
        import traceback
        traceback.print_exc()
예제 #25
0
#encoding:utf-8
# __author__ = 'donghao'
# __time__ = 2019/1/22 19:22
from application import app, manager
from flask_script import Server
import www
manager.add_command(
    "runserver",
    Server(host='127.0.0.1',
           port=app.config['SERVER_PORT'],
           use_debugger=app.config['DEBUG']))


def main():
    manager.run()


if __name__ == '__main__':
    try:
        import sys
        sys.exit(main())
    except Exception as e:
        import traceback
        traceback.print_exc()
예제 #26
0
# -*- encoding:utf-8 -*-

__author__ = 'devin'
__date__ = '2018/12/24/024 14:03'

from application import app, manager
from flask_script import Server

import www

# web server
manager.add_command(
    "runserver",
    Server(host="0.0.0.0",
           port=app.config["SERVER_PORT"],
           use_debugger=True,
           use_reloader=True))


def main():
    manager.run()


if __name__ == "__main__":
    try:
        import sys
        sys.exit(main())
    except Exception as e:
        import traceback
        traceback.print_exc()
예제 #27
0
# -*- coding: utf-8 -*-
from application import app, manager
from flask_script import Server
import www
from jobs.launcher import runJob

##web server
manager.add_command(
    "runserver",
    Server(host='81.70.149.29',
           port=app.config['SERVER_PORT'],
           use_debugger=True,
           use_reloader=True))

#job entrance
manager.add_command('runjob', runJob())


def main():
    manager.run()


if __name__ == '__main__':
    try:
        import sys
        sys.exit(main())
    except Exception as e:
        import traceback
        traceback.print_exc()
예제 #28
0
파일: manager.py 프로젝트: yuhaozi2/peeplus
# -*- coding: utf-8 -*-
from application import app, manager
from flask_script import Server
import core

manager.add_command("runserver", Server(host=app.config["SERVER_HOST"], port=app.config["SERVER_PORT"],
                                        use_debugger=app.config["SERVER_DEBUG"], use_reloader=True, threaded=True))


def main():
    manager.run()


if __name__ == '__main__':
    try:
        import sys
        # import app.helper.Log

        sys.exit(main())
    except Exception as e:
        import traceback

        traceback.print_exc()
예제 #29
0
from application import app, manager
from flask_script import Server
import urls

# web服务器
manager.add_command(
    'runserver',
    Server(host='localhost',
           port=app.config['SERVER_PORT'],
           use_debugger=True,
           use_reloader=True))


def main():
    manager.run()


if __name__ == "__main__":
    try:
        import sys
        sys.exit(main())
    except Exception as e:
        import traceback
        traceback.print_exc()
예제 #30
0
from application import app, manager
from flask_script import Server
import www

# web Server
manager.add_command("runserver",
                    Server(host='0.0.0.0', port=5000, use_debugger=True))


def main():
    manager.run()


if __name__ == "__main__":
    try:
        import sys
        sys.exit(main())
    except Exception as e:
        import traceback
        traceback.print_exc()