1

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.

2 Answers 2

3

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.

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

Comments

0

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.

4 Comments

check your webserver error log (if you are using apache, it will likely be called error.log)
i tried it at another hosting and i am seeing whole code as a page when i enter .py files url
Did you follow the tutorial I linked to?
@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.

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.