forked from leancloud/python-getting-started
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwsgi.py
More file actions
29 lines (19 loc) · 635 Bytes
/
wsgi.py
File metadata and controls
29 lines (19 loc) · 635 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
import os
import leancloud
from gevent.pywsgi import WSGIServer
from geventwebsocket.handler import WebSocketHandler
from app import app
from cloud import engine
APP_ID = os.environ['LC_APP_ID']
MASTER_KEY = os.environ['LC_APP_MASTER_KEY']
PORT = int(os.environ['LC_APP_PORT'])
leancloud.init(APP_ID, master_key=MASTER_KEY)
application = engine
if __name__ == '__main__':
# 只在本地开发环境执行的代码
app.debug = True
server = WSGIServer(('localhost', PORT), application, handler_class=WebSocketHandler)
server.serve_forever()