This project hosts a Python web server to track and display golf scores.
- Python 3 installed on the Raspberry Pi.
- The following files present in the project directory:
server.py
scores.txt
(the file where scores are stored)- The HTML/CSS/JS files (e.g.
index.html
,data.html
, etc.)
-
SSH into the Raspberry Pi (or log in directly) and navigate to the project folder. For example:
cd /home/pi/moss-hill-golf
-
Run the server with:
python3 server.py
-
You should see a message like:
Starting server at http://0.0.0.0:3001
-
Open a browser on the Pi itself or any device on the same network, and go to:
http://<RaspberryPiIP>:3001
Replace
<RaspberryPiIP>
with your Pi’s local IP address (e.g.192.168.x.x
).
If you need to manually edit the raw scores, follow these steps:
-
SSH into the Raspberry Pi (or log in directly) and navigate to the project folder:
cd /home/pi/moss-hill-golf
-
Open the
scores.txt
file in a text editor (for example,nano
):nano scores.txt
-
Make your changes. Each line in
scores.txt
typically looks like this:YYYY-MM-DD HH:MM:SS,hole1,hole2,...,hole9,PlayerName
- Example:
2025-03-01 12:34:56,2,3,4,3,5,2,4,3,4,Reese
- Modify or remove lines as needed, then save your changes.
- Example:
-
Restart the server to load the updated data:
# Stop the running server (Ctrl + C if running in the current shell) python3 server.py
Note: You can also edit scores from the web UI if you have set up the admin password and the edit.html
page, but direct editing of scores.txt
is sometimes easier for bulk changes or quick fixes. As of this commit, direct editing through the edit.html
webpage is not fucntional.
- Port: By default, the server listens on port
3001
. You can change this inserver.py
if needed. - Firewall/Port Forwarding: If you want to access the server from outside your local network, configure your router/firewall to forward port
3001
to the Pi. - Admin Password: If you use the admin features (like
edit.html
), remember to change the defaultADMIN_PASSWORD
inserver.py
.