[Tutor] Option on How to create web Interface

Alan Gauld alan.gauld at btinternet.com
Thu May 22 21:11:04 CEST 2014


On 22/05/14 19:47, Chris “Kwpolska” Warrick wrote:
> On Thu, May 22, 2014 at 12:54 AM, Alan Gauld <alan.gauld at btinternet.com> wrote:
>> But basically this just creates a text file in a folder somewhere.
>> Its only when that is accessed via a web server that it gets
>> sent to a browser, and only as a static file.
>>
>> If you wanted to do it dynamically you'd have a file called
>> something like mypage.cgi which looked like:
>>
>> print("<html><head><title>My web page</title></head>")
>> print("<body>This the body</body></html>")
>>
>> And provided the web server was configured to run python
>> on cgi files you could access it as
>>
>> http://myserver.addresss/mypage.cgi
>
> Sadly, this is not the modern way to do it.  These days, it’s
> recommended to use something like Flask, or Django, or whatnot.  CGI
> is ancient, and problematic.
>

CGI is still how many frameworks operate under the covers.
They just hide it well. But I agree that using a framework
is the only sane way to build a significant web app nowadays
and I was not promoting original CGI as a solution.

However, the OP seemed to be asking about the low level
details of how a web app works and using a framework
(both by design and intent) hides all of that from you
whereas an old fashioned CGI app exposes it.
Hence my illustration.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list