3

I currently have a website set up on an Apache server running on Redhat Linux, and am trying to configure it to be able to run Python scripts. Essentially, I want to allow Python to be executable, so that doing something like www.mysite.com/pyscript.py will run the script rather than display its contents.

I really don't have any Apache experiance, and haven't been able to find any good tutorials on how to figure this out, how do I do this?

2 Answers 2

2

I suggest reading the official Python docs that explain how to run Python on a web server.

In short, they recommend WSGI. For Apache, there's a "quick" installation guide on the mod_wsgi Google project page. If you're using a Python framework such as Django, a guide to using mod_wsgi with Django is available.

Finally, if setting up and maintaining your own server feels like too much work, you might consider hosting your Python web app with a platform-as-a-service (PAAS) offering such as appfog, Google App Engine, Heroku, dotCloud or Gondor. I host a small Python app with Google App Engine and another on appfog and have been pleased with both services.

0

If your server is setup for python and it is only displaying your python script then most likely you do not have the file permission on it set to executable. You have it set to read only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.