本文整理汇总了Python中web.app.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: f
def f(MessageBox):
from web import app
app.MessageBox = MessageBox
try:
app.run(debug=True, use_reloader=False)
except AttributeError:
pass
示例2: start_standalone_server
def start_standalone_server(host=None, port=None, debug=True):
if not config.check():
sys.exit(1)
if not os.path.exists(config.get('base', 'cache_dir')):
os.makedirs(config.get('base', 'cache_dir'))
import db
from web import app
db.init_db()
app.run(host=host, port=port, debug=debug)
示例3:
from web import app
app.run(port=80, host="0.0.0.0")
示例4: Copyright
#!/usr/bin/env python
#
# Copyright (c) 2013 Piston Cloud Computing, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
from web import app
app.logger.setLevel('DEBUG')
port = int(os.environ.get('PORT', 5000))
app.run(host='172.16.200.128', port=port, debug=True)
示例5:
#!/usr/bin/env python
from web import app
app.run(debug=True)
示例6: dirname
import sys
import os
from os.path import dirname, join
sys.path.insert(0, dirname(__file__))
activate_this = join(dirname(__file__), '.env', 'bin', 'activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
from web import app as application
from web.apps.frontend import frontend
application.register_blueprint(frontend)
application.debug = True
if __name__ == '__main__':
application.run('0.0.0.0')
示例7:
#!venv/bin/python
from web import app
if __name__ == "__main__":
app.run(host="0.0.0.0")
示例8: int
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from web import app
if __name__ == '__main__':
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port, debug=True)
示例9: islocal
import os
from web import app
def islocal():
return os.environ["SERVER_NAME"] in ("localhost")
# FIXME this needs to be moved to a private file
app.secret_key = "b'\xdb\xe2\x14c\xee!\xb7F\x9c\xc8x\x8b\x04b\xbf\xad(\xc5(\x9f\x9az\xd6\x92'"
if __name__ == '__main__':
extra_dirs = ['.']
extra_files = extra_dirs[:]
for extra_dir in extra_dirs:
for dirname, dirs, files in os.walk(extra_dir):
for filename in files:
filename = os.path.join(dirname, filename)
if os.path.isfile(filename):
extra_files.append(filename)
host = os.getenv('IP', '0.0.0.0')
port = int(os.getenv('PORT', '5000'))
app.run(host=host, port=port, debug=True, extra_files=extra_files)
示例10:
# -*- coding: utf-8 -*-
"""
Входной скрипт
:copyright: (c) 2013 by Pavel Lyashkov.
:license: BSD, see LICENSE for more details.
"""
from web import app
app.config.from_object('configs.general.DevelopmentConfig')
app.run(host='127.0.0.1', port=4001)
示例11: main
def main():
app.run(host=LISTEN_HOST, port=LISTEN_PORT)
示例12: int
"""
import os
from os import *
import pathlib
from os import environ
from web import app
if __name__ == '__main__':
# Setup the host url and port
HOST = environ.get('SERVER_HOST', 'localhost')
try:
PORT = int(environ.get('SERVER_PORT', '5555'))
except ValueError:
PORT = 5555
# Setup extra_files to watch - http://stackoverflow.com/questions/9508667/reload-flask-app-when-template-file-changes
extra_dirs = ['donkus', 'web']
extra_files = extra_dirs[:]
for extra_dir in extra_dirs:
for dirname, dirs, files in os.walk(extra_dir):
for filename in files:
filename = path.join(dirname, filename)
if path.isfile(filename):
extra_files.append(filename)
# Start with watching the extra files and reloading enabled
app.run(HOST, PORT, extra_files=extra_files, debug=True)
# Start without for Visual Studio debugger to work on static py files at build time
#app.run(HOST, PORT)
示例13: get_easy_settings
from web import app
from config.settings import get_easy_settings
#app.config.from_object(get_easy_settings())
server_settings = get_easy_settings()
app.run(host='0.0.0.0', debug=server_settings.DEBUG, port=server_settings.PORT)
示例14: str
monaco = schema.Monaco()
monaco.refresh(r)
node_id = str(node_id)
if not node_id in monaco.node_ids:
abort(404)
node = schema.MonacoNode(node_id=node_id)
node.refresh(r)
appinfo = node.app_info(r)
data = {
'node_id': node_id,
'hostname': node.hostname,
'FQDN': node.FQDN,
'total_memory': node.total_memory,
'rack': node.rack,
'status': node.status,
'used_memory': appinfo['memory'],
'memory_percent': round(100.0 * appinfo['memory'] / (int(node.total_memory) / 2.0), 2),
'master_servers': len(appinfo['masters']),
'masters': map(str,sorted(map(int,appinfo['masters']))),
'slave_servers': len(appinfo['slaves']),
'slaves': map(str,sorted(map(int,appinfo['slaves']))),
'twemproxy_servers': len(node.twems),
# General info
'nodes': map(str,sorted(map(int,monaco.node_ids))),
}
return render_template("node.html", **data)
if __name__ == '__main__':
app.run('0.0.0.0', debug=True)
示例15:
#!/usr/bin/env python
import argparse
from web import app
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Runs Topmodel Server")
parser.add_argument(
"--remote", "-r", action="store_true", default=False, help="Use data from S3")
parser.add_argument("--development", "-d", action="store_true",
default=False, help="Run topmodel in development mode with autoreload")
args = parser.parse_args()
app.local = not args.remote
app.run(port=9191, host="0.0.0.0",
debug=True, use_reloader=args.development)