当前位置: 首页>>代码示例>>Python>>正文


Python sae.create_wsgi_app函数代码示例

本文整理汇总了Python中sae.create_wsgi_app函数的典型用法代码示例。如果您正苦于以下问题:Python create_wsgi_app函数的具体用法?Python create_wsgi_app怎么用?Python create_wsgi_app使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了create_wsgi_app函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: reload

#!/usr/bin/env python2
# coding=utf-8

import web
import sys, os
from url import urls

default_encoding = 'utf-8'
if sys.getdefaultencoding() != default_encoding:
    reload(sys)
    sys.setdefaultencoding(default_encoding)

management_app = web.application(urls, locals())
# management_app.notfound = models.home.notfound

if __name__ == "__main__":
    if 'SERVER_SOFTWARE' in os.environ:
        import sae

        sae.create_wsgi_app(management_app.wsgifunc())
    else:
        management_app.run()
开发者ID:fangwentong,项目名称:foodcenter,代码行数:22,代码来源:app_manage.py

示例2: int

                if not data:
                    response.close()
                    break
                if xorchar:
                    yield ''.join(chr(ord(x) ^ xorchar) for x in data)
                else:
                    yield data
        except httplib.HTTPException:
            raise


app = gae_application if urlfetch else paas_application
if bae:
    application = bae.core.wsgi.WSGIApplication(app)
elif sae:
    application = sae.create_wsgi_app(app)
else:
    application = app

if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO, format='%(levelname)s - - %(asctime)s %(message)s', datefmt='[%b %d %H:%M:%S]')
    import gevent
    import gevent.server
    import gevent.wsgi
    import gevent.monkey
    gevent.monkey.patch_all(dns=gevent.version_info[0] >= 1)

    server = gevent.wsgi.WSGIServer(('', int(sys.argv[1])), application)
    logging.info('local paas_application serving at %s:%s', server.address[0], server.address[1])
    server.serve_forever()
开发者ID:HanYing924,项目名称:share,代码行数:30,代码来源:wsgi.py

示例3: globals

)

app = web.application(urls, globals())

if __name__ == "__main__":
    task = PeriodRetrieveTask()
    task.start()
    app.run()
    task.stop()
    print 'over'
else:
    import os
    import sae
    root = os.path.dirname(__file__)
    sys.path.insert(0, os.path.join(root, 'site-packages'))

    application = sae.create_wsgi_app(app.wsgifunc())

# from wechat.request import RequestParser
#
# if __name__ == "__main__":
#     with open('/home/zxy/work/code/pocket-share/src/test-data/request.xml') as r:
#         xml = r.read()
#         text_req = RequestParser.parse(xml)
#         print text_req

# from pocket.retrieve import Retrieve
#
# if __name__ == '__main__':
#     r = Retrieve()
#     print r.get_item_list()
开发者ID:xknow,项目名称:pocket-share,代码行数:31,代码来源:main.py

示例4: start_response

    html = u'GoAgent Python Server %s \u5df2\u7ecf\u5728\u5de5\u4f5c\u4e86\uff0c\u90e8\u7f72\u65f6\u95f4 %s\n' % (__version__, ctime)
    start_response('200 OK', [('Content-type', 'text/plain; charset=utf-8')])
    return [html.encode('utf8')]

def app(environ, start_response):
    if urlfetch and environ['REQUEST_METHOD'] == 'POST':
        return gae_post(environ, start_response)
    elif not urlfetch:
        if environ['PATH_INFO'] == 'socks5':
            return paas_socks5(environ, start_response)
        else:
            return paas_application(environ, start_response)
    else:
        return gae_get(environ, start_response)

application = app if sae is None else sae.create_wsgi_app(app)

if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO, format='%(levelname)s - - %(asctime)s %(message)s', datefmt='[%b %d %H:%M:%S]')
    import gevent, gevent.pywsgi, gevent.monkey
    gevent.monkey.patch_all(dns=gevent.version_info[0]>=1)
    def read_requestline(self):
        line = self.rfile.readline(8192)
        while line == '\r\n':
            line = self.rfile.readline(8192)
        return line
    gevent.pywsgi.WSGIHandler.read_requestline = read_requestline
    host, _, port = sys.argv[1].rpartition(':') if len(sys.argv) == 2 else ('', ':', 443)
    if '-ssl' in sys.argv[1:]:
        ssl_args = dict(certfile=os.path.splitext(__file__)[0]+'.pem')
    else:
开发者ID:xuechengwei,项目名称:goagent,代码行数:31,代码来源:wsgi.py

示例5:

# -*- encoding:utf-8 -*-
"""
 主文件
"""
__author__ = "liuchang"

import sae
from rebot import reobt

application = sae.create_wsgi_app(robot.wsgi)
开发者ID:treejames,项目名称:acmhand,代码行数:10,代码来源:index.py

示例6: urisaok

import sae
from sae.ext.shell import ShellMiddleware

def urisaok(environ, start_response):
    status = '200 OK'
    response_headers = [('Content-type', 'text/plain')]
    start_response(status, response_headers)
    return ["Hello, world!"]

application = sae.create_wsgi_app(ShellMiddleware(urisaok, '1q2w3e4r'))
开发者ID:lb-crx,项目名称:radar4crx,代码行数:10,代码来源:shell.py

示例7: change_code_gracefull_reload

# -*- coding: utf-8 -*-
# autoreload
import uwsgi
from uwsgidecorators import timer
from django.utils import autoreload
 
@timer(3)
def change_code_gracefull_reload(sig):
    print "heelo"
    if autoreload.code_changed():
        print "reload it start==="
        uwsgi.reload()
        print "reload it start==="

# django uwsgi
import os
import sys

app_root = os.path.dirname(__file__)
# 两者取其一
sys.path.insert(0, os.path.join(app_root, 'system'))
#sys.path.insert(0, os.path.join(app_root, 'system.bundle.zip'))

import django.core.handlers.wsgi
import sae
os.environ['DJANGO_SETTINGS_MODULE'] = 'memory.settings'
application = sae.create_wsgi_app(django.core.handlers.wsgi.WSGIHandler())
开发者ID:nuannuanwu,项目名称:zhuyuan112,代码行数:27,代码来源:django_wsgi.py

示例8:

template_engine.add_filter('datetime', datetime_filter)

wsgi.template_engine = template_engine

import urls

#wsgi.add_interceptor(urls.user_interceptor)
#wsgi.add_interceptor(urls.manage_interceptor)
wsgi.add_module(urls)




if __name__ == "__main__":
    # init db:
    db.create_engine(**configs['db'])
    wsgi.run()
else:
    import sae
    import sae.const
    import os
    import sys

    root = os.path.dirname(__file__)

    # 两者取其一
    sys.path.insert(0, os.path.join(root, 'site-packages'))
    db.create_engine(user=sae.const.MYSQL_USER, passwd=sae.const.MYSQL_PASS, database=sae.const.MYSQL_DB, port=int(sae.const.MYSQL_PORT), host=sae.const.MYSQL_HOST)
    application = sae.create_wsgi_app(wsgi.get_wsgi_application())

开发者ID:silentsee,项目名称:blog,代码行数:29,代码来源:app.py

示例9: Application

class Application(tornado.web.Application):

    def __init__(self):
        self.tags = []
        self.recent_posts = []
        super(Application, self).__init__(
            handlers=routers.route,
            **settings)
        self.flash_cache()

    def flash_cache(self):
        session = db.Session()
        self.tags = session.query(Tag).all()
        self.recent_posts = session.\
            query(Post.title).order_by(Post.post_time.desc())[:5]
        session.close()


if "SERVER_SOFTWARE" in os.environ:
    try:
        import sae
        application = sae.create_wsgi_app(PaaSApplication())
    except:
        from bae.core.wsgi import WSGIApplication
        application = WSGIApplication(PaaSApplication())
else:
    appilication = Application()
    appilication.listen(8888)
    tornado.ioloop.IOLoop.instance().start()
开发者ID:daqinbuyi,项目名称:t-blog,代码行数:29,代码来源:main.py

示例10: reload

from config import db, urls
import controllers.home

default_encoding = 'utf-8'
if sys.getdefaultencoding() != default_encoding:
    reload(sys)
    sys.setdefaultencoding(default_encoding)

abspath = os.path.dirname(__file__)
if abspath == "":
    abspath = "."
sys.path.append(abspath)
os.chdir(abspath)

app = web.application(urls, globals(), autoreload=True)
app.notfound = controllers.home.notfound

# Session
if web.config.get('_session') is None:
    web.config.session_parameters['cookie_name'] = 'foodcenter_sid'
    store = web.session.DBStore(db, 'hitfd_sessions')
    web.config._session = web.session.Session(app, store, initializer={'logged': False, 'role': 'guest'})

if __name__ == "__main__":
    if 'SERVER_SOFTWARE' in os.environ:
        import sae
        sae.create_wsgi_app(app.wsgifunc())
    else:
        app.run()
开发者ID:fangwentong,项目名称:foodcenter,代码行数:29,代码来源:app.py

示例11: WSGIApplication

'''

import logging; logging.basicConfig(level=logging.INFO)

import os

from transwarp import db
from transwarp.web import WSGIApplication, Jinja2TemplateEngine

from config import configs

# init db:
db.create_engine(**configs.db)

# init wsgi app:
wsgi = WSGIApplication(os.path.dirname(os.path.abspath(__file__)))

template_engine = Jinja2TemplateEngine(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates'))

wsgi.template_engine = template_engine

import urls

wsgi.add_module(urls)

if __name__ == '__main__':
    wsgi.run(9000)
else:
    import sae
    application = sae.create_wsgi_app(wsgi.get_wsgi_application(debug=False))
开发者ID:alphapua,项目名称:webapp,代码行数:30,代码来源:wsgiapp.py


注:本文中的sae.create_wsgi_app函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。