A problem with local development of python?

beginner python development

on the construction of the python environment, as well as the local server python program development understanding and problems, wrong places also look for advice!

understanding: when you see the installation of the python environment in the tutorial, you download the python installation directly--> python interactive write python programs under cmd, or python hello.py directly under cmd to develop python programs.

but my question: I want to try to develop python programs in the appache--> cgi-bin directory , and you can see the effect of the written programs in the browser http://localhost/hello.py. But if there is an import os import module in this hello.py program, the program cannot run , it should not have this module. But python3/python3-cgi-programming.html" rel=" nofollow noreferrer "> rookie tutorial is OK, but I don"t quite understand, so I would like to ask for advice!

moreover, it hurts to report this kind of mistake often.

Mar.02,2021

learn a web framework directly, and don't look at the technical solutions that cgi has not used for a long time.


Don't make a website in this way, it's not safe and the structure is easy to be messed up, except for learning. I haven't encountered this kind of problem. I guess it's the server security setting. Of course, the best way is for you to use try-catch to wrap the part that was imported into os to see what error occurred.

in addition, you can change nginx


for lightweight development, it is recommended to use django or flask, to be developer-friendly

Menu