各种Python库搜索:https://pypi.python.org/pypi
-
1.django启动
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'mytest.settings'
path = os.path.dirname(os.path.abspath(__file__)) + '/mytest'
if path not in sys.path:
sys.path.insert(1, path)
from django.core.wsgi import get_wsgi_application
from bae.core.wsgi import WSGIApplication
application = WSGIApplication(get_wsgi_application())
-
2. tornado使用 启动
import tornado.wsgi
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world! - Tornado\n")
app = tornado.wsgi.WSGIApplication([
(r"/", MainHandler),
])
from bae.core.wsgi import WSGIApplication
application = WSGIApplication(app)
-
3. Cherrypy
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import cherrypy
class HelloWorld(object):
@cherrypy.expose
def index(self):
return "Hello world!"
wsgiapp = cherrypy.Application(HelloWorld(), '/')
from bae.core.wsgi import WSGIApplication
application = WSGIApplication(wsgiapp)