Skip to content

Instantly share code, notes, and snippets.

@mikepianka
Last active January 16, 2025 09:09
Show Gist options
  • Save mikepianka/0d982a4e1d44d8ab1497e1425ededef5 to your computer and use it in GitHub Desktop.
Save mikepianka/0d982a4e1d44d8ab1497e1425ededef5 to your computer and use it in GitHub Desktop.
Python http.server exe
This is Python's http.server that has been bundled to an .exe using PyInstaller. You can use it as a local web server for testing.
Run the local server
1. Copy the server.exe into the folder you want to serve and then double click it to start the local server.
2. A window will pop up letting you know the server is running on port 8000.
3. Open http://localhost:8000/ in your web browser.
4. When you are done, simply close the server.exe window to stop the local server.
If you have another service running on port 8000, you can run on a different port like so:
1. Open Command Prompt
2. Navigate to the folder you want to serve, for example:
>>> E:
>>> cd "E:\\projects\my_web_app"
3. Run server.exe with the desired port after it, for example to run on port 1234:
>>> server.exe 1234
4. The server.exe window will pop up the same as the instructions above.
This file has been truncated, but you can view the full file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment