-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
30 lines (24 loc) · 795 Bytes
/
server.py
File metadata and controls
30 lines (24 loc) · 795 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
from werkzeug.wrappers import Response
from werkzeug.wsgi import SharedDataMiddleware
from lib.app import App
from os import path
def create_app(config):
app = App(config)
app.wsgi_app = SharedDataMiddleware(app.wsgi_app, {
'/public': config['public_path']
})
return app
if __name__ == '__main__':
from werkzeug.serving import run_simple
config = {
'db': {
'host': 'localhost',
'user': 'dipendra',
'password': 'postgres',
'dbname': 'project',
},
'public_path': path.join(path.dirname(__file__), 'public'),
'template_path': path.join(path.dirname(__file__), 'views'),
}
app = create_app(config)
run_simple('0.0.0.0', 5000, app, use_debugger=True, use_reloader=True)