apache - Python file not working while taking it through browser -


i new python.i started study python syntax , tested python codes terminal.

now wants run python file through browser

my operating system ubuntu , python files located in

 /var/www/html/python_test/ 

following code in python file (name 'test.py')

print "hello world" 

its working if run command python test.py in terminal

but not working, while take url
'http://localhost/python_test/test.py' in browser

and getting following error

"not found requested url /python_test/test.py not found on server" 

but if change code in mentioned python file

def index(req):   return "hello world"; 

then working fine, , output "hello world" in browser

note: have added following code in file

/etc/apache2/sites-available/default  <directory /var/www/html/>                 options indexes followsymlinks multiviews                 allowoverride none                 order allow,deny                 allow                 addhandler mod_python .py                 pythonhandler mod_python.publisher                 pythondebug on  </directory> 

and restarted apache

let me know may issue ?,why python files not working in browser?

thanks in advance


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -