How do you set up Python scripts to work in Apache 2.0?

后端 未结 4 1664
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-15 06:00

I tried to follow a couple of googled up tutorials on setting up mod_python, but failed every time. Do you have a good, step-by step, rock-solid howto?

My dev box is

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-15 06:14

    Yes, mod_python is pretty confusing to set up. Here's how I did it.

    In httpd.conf:

    LoadModule python_module modules/mod_python.so
    
    
      AddHandler mod_python .py
      PythonHandler myapp
      PythonDebug On
    

    and in your application directory:

    $ /serverbase/htdocs/myapp$ ls -l
    total 16
    -r-xr-xr-x 1 root sys        6484 May 21 15:54 myapp.py
    

    Repeat the configuration for each python program you wish to have running under mod_python.

提交回复
热议问题