Create new file
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import json
|
3 |
+
import requests
|
4 |
+
import subprocess
|
5 |
+
|
6 |
+
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
|
7 |
+
|
8 |
+
#subprocess.Popen(["gunicorn", "myapp:get_response", "--bind=0.0.0.0:7860"])
|
9 |
+
#subprocess.Popen(["gunicorn", "myapp:get_wsgi_app", "--bind=0.0.0.0:7860"])
|
10 |
+
subprocess.Popen("gunicorn -c gunicorn_config.py '--bind=0.0.0.0:7860' 'quickstart_sst_demo:get_wsgi_app()'", shell=True)
|
11 |
+
|
12 |
+
class RequestHandler(SimpleHTTPRequestHandler):
|
13 |
+
def do_GET(self):
|
14 |
+
if self.path == "/":
|
15 |
+
self.path = "index.html"
|
16 |
+
|
17 |
+
return SimpleHTTPRequestHandler.do_GET(self)
|
18 |
+
|
19 |
+
|
20 |
+
server = ThreadingHTTPServer(("", 8080), RequestHandler)
|
21 |
+
|
22 |
+
server.serve_forever()
|