views:

168

answers:

2

How do I deploy a Python project to a webserver that supports Python via CGI? I'm well versed in PHP, but do not understand CGI's relation to Python in the deployment process.

Any resource links are appreciated.

The web host in question is GoDaddy.

A: 

To actually answer your question about deploying python as CGI (while it does not make a lot of sense on a high activity system - there are occasions where it does the job just fine) you just make sure that your files are executable, have the correct extension and then follow this tutorial. It is what I used to learn from.

EDIT: To be clear - I recommend that you look into Django to deploy web based python applications.

Shane C. Mason
But i am getting internal server error
Oguz
check your webserver error log (if you are using apache, it will likely be called error.log)
Shane C. Mason
i tried it at another hosting and i am seeing whole code as a page when i enter .py files url
Oguz
Did you follow the tutorial I linked to?
Shane C. Mason
yes but it does not run cgi files ?
Oguz
@oguz - No, django based apps are not typically deployed as cgi - its simply not efficient - I am saying that I recommend it for creating web based apps.
Shane C. Mason
+3  A: 

Generally, we use mod_wsgi to make a Python application respond to CGI.

PHP has a special role -- the language runtime IS a CGI application.

Python does not have this special role. Python -- by default -- is not a CGI application. It requires a piece of glue to play well with Apache. mod_wsgi is this glue.

S.Lott