forked from avinassh/slackipy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wsgi.py
30 lines (22 loc) · 923 Bytes
/
wsgi.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
#!/usr/bin/python
import os
virtenv = os.path.join(os.environ.get('OPENSHIFT_PYTHON_DIR', '.'), 'virtenv')
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
exec_namespace = dict(__file__=virtualenv)
with open(virtualenv, 'rb') as exec_file:
file_contents = exec_file.read()
compiled_code = compile(file_contents, virtualenv, 'exec')
exec(compiled_code, exec_namespace)
except IOError:
pass
from main import app as application
application.config['SLACK_TEAM_ID'] = os.environ['SLACK_TEAM_ID']
application.config['SLACK_API_TOKEN'] = os.environ['SLACK_API_TOKEN']
application.config['SECRET_KEY'] = os.environ['FLASK_SECRET_KEY']
# Below for testing locally only
if __name__ == '__main__':
from wsgiref.simple_server import make_server
httpd = make_server('localhost', 8051, application)
# Wait for a single request, serve it and quit.
httpd.serve_forever()