dixitramjendra commited on
Commit
33a2f10
·
1 Parent(s): 44d238d

Fix: Serve dashboard as root

Browse files
Files changed (1) hide show
  1. serve_forex_macd.py +7 -2
serve_forex_macd.py CHANGED
@@ -11,7 +11,12 @@ from pathlib import Path
11
  # Hugging Face Spaces expects the app to run on port 7860
12
  PORT = 7860
13
 
14
- class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
 
 
 
 
 
15
  def end_headers(self):
16
  self.send_header('Access-Control-Allow-Origin', '*')
17
  self.send_header('Cache-Control', 'no-store, no-cache, must-revalidate')
@@ -20,7 +25,7 @@ class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
20
  def main():
21
  os.chdir(Path(__file__).parent)
22
 
23
- Handler = MyHTTPRequestHandler
24
 
25
  # Bind to 0.0.0.0 to be accessible externally
26
  with socketserver.TCPServer(("0.0.0.0", PORT), Handler) as httpd:
 
11
  # Hugging Face Spaces expects the app to run on port 7860
12
  PORT = 7860
13
 
14
+ class DashboardHandler(http.server.SimpleHTTPRequestHandler):
15
+ def do_GET(self):
16
+ if self.path == '/':
17
+ self.path = '/forex_macd_dashboard.html'
18
+ return http.server.SimpleHTTPRequestHandler.do_GET(self)
19
+
20
  def end_headers(self):
21
  self.send_header('Access-Control-Allow-Origin', '*')
22
  self.send_header('Cache-Control', 'no-store, no-cache, must-revalidate')
 
25
  def main():
26
  os.chdir(Path(__file__).parent)
27
 
28
+ Handler = DashboardHandler
29
 
30
  # Bind to 0.0.0.0 to be accessible externally
31
  with socketserver.TCPServer(("0.0.0.0", PORT), Handler) as httpd: