本文整理汇总了Python中server.app.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runserver
def runserver():
if len(sys.argv) > 1:
portNum = sys.argv[1]
else:
portNum = '8000'
port = int(os.environ.get('PORT', portNum))
app.debug = True
app.run(host='0.0.0.0', port=port)
示例2: server
def server(config):
set_config(config)
from server import app
port = int(os.environ.get("RECAST_FRONTEND_PORT", 5000))
ssl_kwargs = dict(
ssl_context = (os.environ['RECAST_SSL_CERT'],os.environ['RECAST_SSL_KEY'])
) if os.environ.get('RECAST_SSL_ENABLE',True) else {}
app.run(host='0.0.0.0', port=port, threaded = True, **ssl_kwargs)
示例3:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: le4f.net
from server import app
#如应用于生产环境 app.run(host='0.0.0.0', port=80) 并注意可能存在的安全隐患.
#有些情况下 localhost 会出问题,本地需要添加一个 hosts 。
if __name__ == '__main__':
app.run(host='127.0.0.1', port=8080, debug=True)
示例4: main
def main():
try:
app.run(host=CONFIG['host'], debug=CONFIG['debug'], port=CONFIG['port'])
except KeyboardInterrupt:
sys.exit(0)
示例5:
# The entry point for the server
from server import app
import json
settings = json.load(open('config.json'))
app.run(debug=settings.get('debug', False), host=settings.get('host', '0.0.0.0'))
示例6:
from server import app
app.run(port=5000, debug=True)
示例7:
#!/usr/bin/python
from server import app, manager
if __name__ == '__main__':
app.run(debug = True, host="0.0.0.0", threaded=True)
示例8:
from server import app
import os
if __name__ == '__main__':
port = os.getenv('NEWSPAPER_PORT', '38765')
app.run(port=int(port), host='0.0.0.0')
示例9: run_server
def run_server():
"""
Run the demo server.
"""
app.run(debug=True, port=5001)
示例10: server
def server(config):
set_config(config)
from server import app
port = int(os.environ.get("RECAST_PORT", 5000))
app.run(host='0.0.0.0', port=port, ssl_context = (os.environ['RECAST_SSL_CERT'],os.environ['RECAST_SSL_KEY']) )
示例11:
# -*- coding:utf-8 -*-
import socket
# fetch local ip address
localhost = socket.gethostbyname(socket.gethostname())
print localhost
from server import app as application
if __name__ == "__main__":
application.run(host=localhost, debug=True)
示例12:
from server import app as application
from config import HOST, \
PORT, \
DEBUG
if __name__ == '__main__':
application.run(host=HOST,
port=PORT,
debug=DEBUG)
示例13:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: le4f.net
from server import app
#如应用于生产环境 app.run(host='0.0.0.0', port=80) 并注意可能存在的安全隐患.
if __name__ == '__main__':
app.run(host='localhost', port=8080, debug=True)
示例14:
#! /usr/bin/env python
#-*- coding: utf-8 -*-
from server import app
if __name__ == '__main__':
app.run('0.0.0.0', 23300, debug=True)
示例15:
#
# 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.
#
#!/usr/bin/env python
from server import app, db
if __name__ == "__main__":
# print app
# print app.config['SQLALCHEMY_DATABASE_URI']
app.debug = True
db.create_all(app=app)
app.run(host='0.0.0.0',port=5002, debug=True)
# if __name__ == "__main__":
# from cherrypy import wsgiserver
#
# db.create_all(app=app)
# # app.run(host='0.0.0.0',port=5000, debug=True)
# d = wsgiserver.WSGIPathInfoDispatcher({'/': app})
# server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 5001), d)
# try:
# server.start()
# except KeyboardInterrupt:
# server.stop()