-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.py
More file actions
30 lines (25 loc) · 854 Bytes
/
application.py
File metadata and controls
30 lines (25 loc) · 854 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
30
import os
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.session import UnencryptedCookieSessionFactoryConfig
here = os.path.dirname(os.path.abspath(__file__))
def main():
# configuration settings
settings = {}
settings['db'] = os.path.join(here, 'data.db')
settings['mako.directories'] = os.path.join(here, 'templates')
# session factory
session_factory = UnencryptedCookieSessionFactoryConfig('itsaseekreet')
# configuration setup
config = Configurator(settings=settings)
config.scan("views")
config.scan("subscribers")
# routes setup
config.add_route('list', '/')
# serve app
app = config.make_wsgi_app()
return app
if __name__ == '__main__':
app = main()
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()