Skip to content

Commit

Permalink
Added Web UI server on port 4000
Browse files Browse the repository at this point in the history
  • Loading branch information
sudiptab2100 committed Nov 19, 2023
1 parent 24c5f32 commit 8c2a6d6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</head>
<body>

<h2>Filter Data</h2>
<h2>Search Logs</h2>

<form id="filterForm">
<table>
Expand Down
23 changes: 23 additions & 0 deletions src/ui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import http.server
import socketserver
import webbrowser
import os

PORT = 4000

# Define a custom handler to serve files
Handler = http.server.SimpleHTTPRequestHandler

# Change the current working directory to the directory containing index.html
web_dir = "."
os.chdir(web_dir)

# Start the server
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print(f"Serving at port {PORT}")

# Open the default web browser
webbrowser.open(f"http://localhost:{PORT}/index.html")

# Keep the server running until interrupted
httpd.serve_forever()

0 comments on commit 8c2a6d6

Please sign in to comment.