Last active
February 17, 2021 10:10
-
-
Save TerenceLiu98/303f6048ddda0e1a51fe2e24229e1699 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from threading import Thread | |
import time | |
port_number = "8000" | |
def run_on(port): | |
os.system("python -m http.server " + port) | |
if __name__ == "__main__": | |
server = Thread(target=run_on, args=[port_number]) | |
#run_on(port_number) #Run in main thread | |
#server.daemon = True # Do not make us wait for you to exit | |
server.start() | |
time.sleep(2) #Wait to start the server first |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment