How To: Spin up Python HTTP Server
Picture this. You’re working on one of Cal Poly’s school machines, writing some bug-free FPGA designs in Xilinx Vivado. Just as you’re about to sign off, you notice that OneDrive stopped syncing! Oh no :( We don’t want to lose the work, but we want to transfer it over to our personal computer.
Here’s a quick, easy solution that is incredibly handy ;)
First, let’s ensure we have ALL the requirements:
- python3
Yep, that’s all we need! Now say we have this file structure:
As we can see, there’s a Verilog file titled 7seg-pmod.v That’s the file we want to transfer. Now in a terminal windows, let’s run: python3 -m http.server
This opens up a local HTTP server on port 8000 (by default). Therefore, we can navigate to the IP address of the computer containing the file on our client computer and retrieve the file, like so:
Now back on our server, we can verify the verilog file was downloaded as well:
And just like that, we now saved the file on our client machine and no longer have to worry about OneDrive failing.
Mission: Success.