-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.py
executable file
·60 lines (54 loc) · 1.88 KB
/
index.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import web
from controller import *
import sys, logging
from wsgilog import WsgiLog#, LogIO
class Log(WsgiLog):
def __init__(self, application):
WsgiLog.__init__(
self,
application,
logformat = '[%(asctime)s] %(filename)s:%(lineno)d(%(funcName)s): [%(levelname)s] %(message)s',
tofile = True,
file = '/home/pi/source/xcf/log/webpy.log',
interval = 's',
backups = 1)
#sys.stdout = LogIO(self.logger, logging.INFO)
#sys.stderr = LogIO(self.logger, logging.ERROR)
home = ''
os.environ['SCRIPT_NAME'] = home
os.environ['REAL_SCRIPT_NAME'] = home
urls = (
'/(.*\.css)', 'cssStatics',
'/(.*\.js)', 'jsStatics',
'/', 'index',
'/login', 'login',
'/welcome', 'welcome',
'/signup', 'signup',
'/modify', 'modify',
'/db_auth', 'db_auth',
'/db_callback', 'db_callback',
'/qq_auth', 'qq_auth',
'/qq_callback', 'qq_callback',
'/wb_auth', 'wb_auth',
'/wb_callback', 'wb_callback',
'/otherpassportbind', 'otherpassportbind',
'/exit', 'exit',
'/authorize', 'authorize',
'/authorize_mod', 'authorize_mod',
)
app = web.application(urls, globals())
session = web.session.Session(app, web.session.DiskStore('sessions'),
initializer = {'login': False, 'username': '', 'welcome': '', 'profile_id': 0,
'oauth_access_token': '', 'oauth_expires': '', 'oauth_server_user_id': '',
'from_where': '', 'bind_cnt': 0})
if __name__ == "__main__":
#web.wsgi.runwsgi = lambda func, addr = None: web.wsgi.runfcgi(func, addr)
web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
web.debug = False
web.config._session = session
app.run(Log)
#with open('/home/pi/source/xcf/log.txt') as f:
# f.write('xxx', 'r')