-2

my python program is not executing at the server end and instead when i press the submit buttonthe browser is displaying the raw code of my python file.

I have kept my file in the path var/www/webgui.py.

I have installed apache web server.

please help on this.

2
  • If you don't post your code or log traces... How do you think that someone could help you ? Commented Mar 17, 2014 at 7:30
  • Is the apache web server actually running during this process. You know you have to manually turn it on. Commented Mar 17, 2014 at 7:53

1 Answer 1

0

Apache thinks your python file is a file to be served, and not a script to run. You need to configure apache to tell it how to treat the python files. There are a number of ways of doing this.

See here Configure Apache to use Python just like CGI PHP and http://docs.python.org/2/howto/webservers.html

Essentially you have to configure an extension that allows apache to run python scripts. mod_python and mod_wsgi are two examples (you only need one).

Sign up to request clarification or add additional context in comments.

1 Comment

I tried som stuff like adding the below code in /etc/apache2/sites-available/default AddHandler mod_python .py PythonHandler mod_python.publisher PythonDebug On but still it is not working,it is still retrnin g the raw code.please help on this as i am new to python....

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.