title: Why avoid CGI for Python with LAMP hosting?
body: <p>I have been using PHP for years. Lately I've come across numerous forum posts stating that <strong>PHP is outdated</strong>, that modern programming languages are easier, more secure, etc. etc.</p>
  
  <p>So, I decided to <strong>start learning Python</strong>. Since I'm used to using PHP, I just started building pages by uploading an .htaccess file with:</p>
  
  <pre><code>addtype text/html py
  addhandler cgi-script .py
  </code></pre>
  
  <p>Then, my sample pages look like:</p>
  
  <pre>
  #!/usr/bin/python
  print "content-type: text/html\n\n"
  print "html tags, more stuff, etc."
  </pre>
  
  <p>This works fine. But, I came across a comment in a post that said that <strong>CGI isn't the best way to use Python</strong>. Of course, it didn't mention what <em>is</em> the best way.</p>
  
  <p><strong>Why is it that using CGI is not the best way to use Python? What is the alternative?</strong></p>
  
  <p>Is there some <strong>totally other way</strong> to set up a simple Python site? Is there some completely different paradigm I should be looking at outside of .htaccess and .py files?</p>
  
  <h3>Related</h3>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/43709/pros-and-cons-of-different-approaches-to-web-programming-in-python">Pros and Cons of different approaches to web programming in Python</a></li>
  <li><a href="https://stackoverflow.com/questions/68986/whats-a-good-lightweight-python-mvc-framework">What’s a good lightweight Python MVC framework?</a> (esp., <a href="https://stackoverflow.com/questions/68986/whats-a-good-lightweight-python-mvc-framework/83263#83263">@Kevin Dangoor's answer</a>)</li>
  <li><a href="https://stackoverflow.com/questions/596729/how-do-i-use-python-for-web-development-without-relying-on-a-framework">How do I use python for web development without relying on a framework?</a></li>
  <li><a href="https://stackoverflow.com/questions/490210/python-web-framework-not-app-framework-or-cms-framework">Python Web Framework - Not App Framework or CMS Framework</a></li>
  <li><a href="https://stackoverflow.com/questions/581038/python-web-programming">Python web programming</a></li>
  </ul>