File size: 693 Bytes
6f9d3db
 
 
 
 
 
 
 
 
fc36b22
6f9d3db
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
import json
import requests
import subprocess

from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer

#subprocess.Popen(["gunicorn", "myapp:get_response", "--bind=0.0.0.0:7860"])
#subprocess.Popen(["gunicorn", "myapp:get_wsgi_app", "--bind=0.0.0.0:7860"])
subprocess.run("GUNICORN_CMD_ARGS='--timeout=500 --bind=0.0.0.0:7860' gunicorn 'quickstart_sst_demo:get_wsgi_app()'", shell=True)

class RequestHandler(SimpleHTTPRequestHandler):
    def do_GET(self):
        if self.path == "/":
            self.path = "index.html"
        
        return SimpleHTTPRequestHandler.do_GET(self)


server = ThreadingHTTPServer(("", 8080), RequestHandler)

server.serve_forever()