Python is a great language to write scripts. Sometimes if we need to access or consume an API coded in Python, we need to upload the file on a web server.
If you are going to choose a web server, select one that has got good support for Python. There might be many free web servers out there but it is always good to get a paid one with minimum cost. the reason being the support offered from a paid server is awesome. They normally have 24 hrs support with live chat which is great 🙂 . since it is quite inevitable that you might get stuck somewhere in your project and more often than not the reason would be the server. Sometimes you are not familiar what the server is capable to do and that’s when you need to ask question to the experts. It saves a great deal of time and effort as opposed to figuring it out on your own.
Python has many projects for deployment of code, CGI is one of the oldest and it is still used. If you are planning to use the CGI project then the code has to be saved in the cgi-bin directory of your server. The extension should be .py . In order to load this file on your web browser just use the file location. For example http://www.samplehost.com/cgi-bin/hello.py
Many times you might get an error at this point and most commonly it is the Internal Server Error. There could be many reasons why that error has occurred. I will be blogging in detail about that. One of the possibilities could be an error in your code itself. It could be a missing parenthesis or some syntax error. But once you are able to figure out the errors, more often not the code should run without any Issues 🙂 .