Beispiel #1
0
def runserver():
    """
    development模式启动命令函数
    To use: python3 manager.py runserver
    """
    app.run(host=app.config.get('HOST', '0.0.0.0'),
            port=app.config.get('PORT', 8080))
Beispiel #2
0
from apps import app

if __name__ == '__main__':
    app.run(debug=app.config['DEBUG'])
Beispiel #3
0
#!/usr/bin/env python3
from apps import app

app.run(debug=True, host='0.0.0.0')
Beispiel #4
0
from apps import app

app.run(host='127.0.0.1', port=5000, debug=True)
Beispiel #5
0
#!/usr/bin/env python
#coding=utf8

from apps import app

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8888, debug=True)
Beispiel #6
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# -*- coding: utf-8 -*-


# from views import *


from apps import app

app.run(host="0.0.0.0", port=8080, debug=True)
Beispiel #7
0
# encoding: utf-8
from apps import app

if __name__ == '__main__':
    app.run(port=5000)
Beispiel #8
0
# def init_db():
#     with closing(connect_db()) as db:
#         for line in app.open_resource('schema.sql', mode='r'):
#             db.cursor().execute(line)
#         # with app.open_resource('schema.sql', mode='r') as f:
#         #     db.cursor().executescript(f.read())open('schema.sql', 'r')
#         db.commit()


@app.before_request
def before_request():
    g.db = connect_db()


@app.teardown_request
def teardown_request(exception):
    #any exception, need close the db connect
    db = getattr(g, 'db', None)
    if db is not None:
        db.close()


@app.after_request
def close_db(response):
    #finally, need close the db connect and return the response
    return response

if __name__ == '__main__':
    #init_db()
    app.run()
Beispiel #9
0
#!/usr/bin/env python
# encoding: utf-8
"""
@author: zhanghe
@software: PyCharm
@file: run_apps.py
@time: 2019-09-27 12:51
"""

from apps import app

host = app.config.get('HOST')
port = app.config.get('PORT')
debug = app.config.get('DEBUG')

if __name__ == '__main__':
    app.run(host=host, port=port, debug=debug)
Beispiel #10
0
#!/usr/local/bin/python
from apps import app
if __name__ == '__main__':
    app.secret_key = 'mysecret'
    app.run(debug=True, use_reloader=True, port=8000)
Beispiel #11
0
def runserver():
    app.run(host='127.0.0.1', port=5000, debug=True)
Beispiel #12
0
# -*- coding: utf-8 -*-
# @Time    : 2020/3/6 上午10:38
# @Author  : Hui
# @File    : run_case.py

from apps import app
from apps.core.views import coreApi
from apps.users.views import userApi
from apps.auth.views import authApi

#将蓝图注册到app中
app.register_blueprint(coreApi, url_prefix='/methods_class')
app.register_blueprint(userApi)
app.register_blueprint(authApi)

if __name__ == '__main__':
    app.run(port=7080, debug=True)
Beispiel #13
0
#!flask/bin/python


from apps import app


app.config.from_object('config')

if __name__ == '__main__':
    app.run(debug=True, threaded=True, host='0.0.0.0', port=9050)
Beispiel #14
0
#!/usr/bin/env python
#encoding:utf-8
from apps import app

if __name__ == "__main__":
    app.run(host='0.0.0.0',port=22222)
Beispiel #15
0
from apps import app

if __name__ == '__main__':
	app.run(debug = True)
Beispiel #16
0
from apps import app

if __name__ == '__main__':
    app.run(debug=True, host="0.0.0.0", port="8000")
Beispiel #17
0
from apps import app
if __name__ == "__main__":
    app.run(debug=True, port=5001)
Beispiel #18
0
#!/usr/bin/env python3
from apps import app

app.run(debug=True, host="0.0.0.0")
Beispiel #19
0
from apps import app
app.run(host="0.0.0.0", port="8080")

Beispiel #20
0
def start():
    load_routs()
    Base.metadata.create_all(engine)
    app.run(debug=True, host='0.0.0.0', port=5000)
Beispiel #21
0
# -*- coding: utf-8 -*-
# @Time : 2019/6/24 15:07

from apps import app
from views import app_user

APP_CONFIG = {'host': '0.0.0.0', 'port': 9001, 'debug': True}

if __name__ == '__main__':
    app.register_blueprint(app_user.blue)
    app.run(**APP_CONFIG)
Beispiel #22
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
A micro-application to display bibtex bibliography in browser.

"""

from apps import app
from config import DEBUG, PORT

if __name__ == '__main__':
    # Launch flask:
    app.run(debug=DEBUG, port=PORT, host='0.0.0.0')
Beispiel #23
0
#!flask/bin/python
from apps import app
if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=7777)
Beispiel #24
0
from apps import app

print app
if __name__ == '__main__':
    app.run(host='0.0.0.0', threaded=True)
Beispiel #25
0
from apps import app
from views import upload

if __name__ == '__main__':

    app.register_blueprint(upload.blue)

    app.run(host='0.0.0.0')
Beispiel #26
0
from apps import app
import os, sys

if __name__ == "__main__":
    args = sys.argv
    args.append("run")

    if args[1] == "seeduser":
        from apps.test.user import seedUser
        seedUser()
    else:
        port = int(os.environ.get('PORT', 5000))
        app.run(debug=True, host='0.0.0.0', port=port)
Beispiel #27
0
def run():
    db.create_all()
    app.config.from_object('config.Config')
    app.run(host=app.config['SERVER_IP'], port=app.config['PORT'])
Beispiel #28
0
 def run(self):
     app.run(host = '0.0.0.0')
Beispiel #29
0
from apps import app

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=8000)
Beispiel #30
0
    }]

    return render_template('index.html', user=user, posts=posts)


@app.route('/login', methods=['GET', 'POST'])
def login():
    # Creating an object of the class LoginForm
    form = LoginForm()
    # Action once submit button pressed
    if form.validate_on_submit():
        # Flash used for displaying messages on a webpage
        flash('Login requested for user {}, remember me={}'.format(
            form.username.data, form.remember_me.data))
        # directs user to 'index' page
        return redirect(url_for(('index')))

    return render_template('login.html', title='Sign In', form=form)


# @app.route('/homepage', methods=['GET', 'POST'])
# def homepage():
#     homepage = LoginForm()
#     user = homepage.username.data
#     return render_template('homepage.html', user=user)

if __name__ == "__main__":
    # with app.app_context():
    #     db.create_all()
    app.run(host='127.0.0.1', port=8001)
Beispiel #31
0
from apps import app

if __name__ == '__main__':
    app.run('0.0.0.0', 8888, debug=True)
Beispiel #32
0
from apps import app

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=6070, debug=True, workers=4)
Beispiel #33
0
#!/usr/bin/env python
from apps import app
from werkzeug.contrib.fixers import ProxyFix

if __name__ == "main":
    app.wsgi_app = ProxyFix(app.wsgi_app)
    app.run()
Beispiel #34
0
from apps.login import login as login_blue_print
from apps import app


# 注册蓝本
app.blueprint(home_blue_print)
app.blueprint(login_blue_print)

# print(app.config.DEBUG)

if __name__ == "__main__": # 使用这种方式将其包装起来,以便它只在解释器直接运行时执行。

    # print(app.url_for('static', name='static', filename='file.txt'))
    # print(app.config.BASE_DIR)
    # /home/static/file.txt
    app.run(host='0.0.0.0', port=8000,workers=1, debug=app.config['DEBUG'],access_log=True)
    # access_log = True/False 可以使用自己的日志配置 logging ,自带三种日志,可以参考官网
    # works多进程,多核心,数量参考cpu的核心数


# 部署 有2种方式,2种我都试过,推荐第2种Gunicorn ,官方说,可以减少内存泄漏的影响
'''
第一种
python -m sanic server.app --host=0.0.0.0 --port=1337 --workers=1

(venv) Grabbys-MacBook-Pro:sanic-web grabbywu$ python -m sanic server.app --host=0.0.0.0 --port=1337 --workers=1
[2018-04-24 22:10:45 +0800] [1496] [INFO] Goin' Fast @ http://0.0.0.0:1337
[2018-04-24 22:10:45 +0800] [1496] [INFO] Starting worker [1496]
Server successfully started!
^C
[2018-04-24 22:11:42 +0800] [1496] [INFO] Stopping worker [1496]
Beispiel #35
0
# -*- encoding: utf-8 -*-
from apps import app

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=9896)

Beispiel #36
0
# -*- coding: utf-8 -*-
# @Time    : 2020/3/6 上午10:38
# @Author  : Hui
# @File    : manage.py

from apps import app
from apps.core.views import coreApi
from apps.users.views import userApi
from apps.auth.views import authApi

#将蓝图注册到app中
app.register_blueprint(coreApi, url_prefix='/core')
app.register_blueprint(userApi)
app.register_blueprint(authApi)

if __name__ == '__main__':
    app.run(debug=True)
Beispiel #37
0
from apps import app

if __name__ == '__main__':
    app.run(host='127.0.0.1', port=8888)
Beispiel #38
0
def runserver():
    app.run(host='127.0.0.1', port=5000, debug=True)