Set webRoot #44

Closed
opened 2026-10-05 01:17:31 +02:00 by adam · 2 comments
Owner

In
https://github.com/SpudGunMan/meshing-around/blob/main/modules/web.py

replace

# set webRoot index.html location
webRoot = "etc/www"

with

# Determine the directory where this script is located.
script_dir = os.path.dirname(os.path.realpath(__file__))

# Go up one level from the modules directory to the project root.
project_root = os.path.abspath(os.path.join(script_dir, ".."))

# Build the absolute path to the webRoot folder; to where index.html is located.
webRoot = os.path.join(project_root, "etc", "www")

Allows for it to be started as a service using absolute paths.

In https://github.com/SpudGunMan/meshing-around/blob/main/modules/web.py replace ```python # set webRoot index.html location webRoot = "etc/www" ``` with ```python # Determine the directory where this script is located. script_dir = os.path.dirname(os.path.realpath(__file__)) # Go up one level from the modules directory to the project root. project_root = os.path.abspath(os.path.join(script_dir, "..")) # Build the absolute path to the webRoot folder; to where index.html is located. webRoot = os.path.join(project_root, "etc", "www") ``` Allows for it to be started as a service using absolute paths. <!-- github-sync-id:2834178224 -->
adam closed this issue 2026-10-05 01:17:31 +02:00
Author
Owner

Instead of this

print(f"Serving reports at http://localhost:{PORT} Press ^C to quit.\n\n")

Do this as well.

# Set the desired IP address
server_ip = '127.0.0.1'

# Create the HTTP server instance with the desired IP address
httpd = http.server.HTTPServer((server_ip, PORT), QuietHandler)

# Print out the URL using the IP address stored in server_ip
print(f"Serving reports at http://{server_ip}:{PORT} Press ^C to quit.\n\n")

Allowing for one to change the server_ip this gets attached to. In my case I'm using a VPN IP.

Instead of this ```python print(f"Serving reports at http://localhost:{PORT} Press ^C to quit.\n\n") ``` Do this as well. ```python # Set the desired IP address server_ip = '127.0.0.1' # Create the HTTP server instance with the desired IP address httpd = http.server.HTTPServer((server_ip, PORT), QuietHandler) # Print out the URL using the IP address stored in server_ip print(f"Serving reports at http://{server_ip}:{PORT} Press ^C to quit.\n\n") ``` Allowing for one to change the server_ip this gets attached to. In my case I'm using a VPN IP. <!-- github-comment-id:2638298898 -->
Author
Owner

thanks :)

thanks :) <!-- github-comment-id:2638601403 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/meshing-around#44