-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
28 lines (24 loc) · 943 Bytes
/
main.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
from web import application, httpserver, debugerror, config, session
from app import config as appconfig
from app.config import generate_dict_urls
PORT = 8000
DEBUG = True
COOKIE = 'webpyskeleton_cookie_session_id'
class MyApplication(application):
def run(self, port=PORT, *middleware):
func = self.wsgifunc(*middleware)
return httpserver.runsimple(func, ('0.0.0.0', port))
if __name__ == "__main__":
urlpatterns = generate_dict_urls()
app = MyApplication(urlpatterns, globals(), True)
config.session_parameters['cookie_name'] = COOKIE
session = session.Session(app,
session.DiskStore('sessions'),
initializer={'data': {}})
appconfig.put_session(session)
app.notfound = appconfig.render_not_found
if DEBUG:
app.internalerror = debugerror
else:
app.internalerror = appconfig.render_internal_error
app.run()