-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.py
More file actions
38 lines (30 loc) · 808 Bytes
/
hello.py
File metadata and controls
38 lines (30 loc) · 808 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
31
32
33
34
35
36
37
38
import web
import json
import os
import dj_database_url
urls = (
'/', 'Index',
'/add', 'Add',
'/env', 'Env',
)
database_config = dj_database_url.config()
db = web.database(dbn = 'postgres',
host = database_config['HOST'],
user = database_config['USER'],
pw = database_config['PASSWORD'],
db = database_config['NAME'])
app = web.application(urls, globals())
wsgi_app = web.application(urls, globals()).wsgifunc()
class Index:
def GET(self):
junk = db.select('junk')
return web.template.render('.').index(junk)
class Env:
def GET(self):
return os.environ
class Add:
def POST(self):
i = web.data()
print json.loads(i)
if __name__ == "__main__":
app.run()