Executing a Python script in Apache2

前端 未结 6 1833
被撕碎了的回忆
被撕碎了的回忆 2020-12-04 22:51

I am trying to execute a Python program using Apache. However, Apache will only serve the file and not actually execute it. The permissions on the file are r/w/x and it is

6条回答
  •  無奈伤痛
    2020-12-04 23:17

    In my case, it was a trivial issue. I had to add this line:

    #!/usr/bin/python3
    

    to the top of every .py file I wanted to run.

    Then, everything started working correctly.

提交回复
热议问题