Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>[If] Python being used so widely for web development, Why cant it be as simple as PHP? ie i would love to write index.py...</p> </blockquote> <p>Python <em>can</em> be as simple as PHP, as per your example. The simplest way to make the above work is to use CGI (and call your file <code>index.cgi</code> rather than <code>index.py</code>, then your script will work just fine. Though you should really specify the content type first, like this:</p> <pre><code>print 'Content-type: text/html' </code></pre> <p>This would apply in PHP as much as Python. <a href="http://docs.python.org/library/cgi.html" rel="noreferrer">Python's CGI module</a> will get you up and running very quickly.</p> <blockquote> <p>As far as what i read, I've to use CGI, mod_wsgi, etc. to deploy</p> </blockquote> <p>You would normally choose one or the other, and realistically you would most likely choose a framework which is based on the more modern WSGI and not worry about the low-level stuff. But if you don't want to, you don't need to bother with these low-level interfaces.</p> <blockquote> <p>Restart the server to see the changes</p> </blockquote> <p>Probably not. Having to restart the server is a limitation of the framework and deployment configuration, and is typically not required. If you use <code>mod_python</code> this may apply, but generally not (many frameworks support auto-reloading, for example).</p> <p>Python has a great wealth of resources for web development. There are bare-bones systems (eg. CGI, mod_wsgi), lightweight systems (eg. CherryPy) and entire frameworks (eg. Zope). You can choose one that best suits your needs.</p> <p>Being able to create a simple file and produce some output might help get something going quickly, but it is not really a sign of a rich, mature, featureful framework. Sure, you can start displaying something straight away, but what then? All of a sudden you will need to either import or write all the same sorts of functionality that web frameworks provide. For a non-trivial web app, you need non-trivial framework.</p> <p>For example, something like <a href="http://www.djangoproject.com/" rel="noreferrer">Django</a> will give you a persistence framework, auto-generated admin interface, a tempting language, URL dispatch system, and much more. You can focus on your app logic, and not worry about the lower level details. Django is a good place to start, as it has great documentation and the tutorial will get you going very quickly.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload