How can I create an local webserver for my python scripts?

后端 未结 3 1945
我寻月下人不归
我寻月下人不归 2021-02-01 07:05

I\'m looking to use a local webserver to run a series of python scripts for the user. For various unavoidable reasons, the python script must run locally, not on a server. As a

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-01 07:25

    Best way is to make your own local server by using command prompt.

    1. Make a new folder say Project
    2. Make a new folder inside project & name it as "cgi-bin"(without quotes)
    3. Paste your .py file inside the cgi-bin folder
    4. Open cmd and change to the directory from which you want to run the server and type "python -m CGIHTTPServer"(without quotes)
    5. Minimize the cmd window & open your browser and type "localhost:8000/cgi-bin/yourpythonfilename.py"(without quotes).

提交回复
热议问题