Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100908 > unrolled thread

CGI

Started byPol Hallen <pythonml@fuckaround.org>
First post2015-12-26 10:41 +0100
Last post2015-12-27 21:01 +0100
Articles 4 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  CGI Pol Hallen <pythonml@fuckaround.org> - 2015-12-26 10:41 +0100
    Re: CGI Maitu Zentz <zen@nonirvana.org> - 2015-12-27 17:19 +0100
    Re: CGI Laurent Delacroix <laurent@krutt.org> - 2015-12-27 18:59 +0100
      Re: CGI Chris Warrick <kwpolska@gmail.com> - 2015-12-27 21:01 +0100

#100908 — CGI

FromPol Hallen <pythonml@fuckaround.org>
Date2015-12-26 10:41 +0100
SubjectCGI
Message-ID<mailman.31.1451231525.11925.python-list@python.org>
Merry Christmas to all :-)

A (newbie) question: I'd like learn about CGI pyhton script to create 
some utility using http://localhost/python_script01.py

Something like that:

#!/usr/bin/python
print "Content-type: text/html"
print
print "<html>"
print "<center>Hello!</center>"
print "</html>"

How can I execute a local command (like ls or similar) and show output 
via browser?

I didn't find enough documentation to work with python and CGI :-/

Is python not good language to use it with CGI?

Thanks for help! :)

Pol

[toc] | [next] | [standalone]


#100910

FromMaitu Zentz <zen@nonirvana.org>
Date2015-12-27 17:19 +0100
Message-ID<73be1$56800f9d$54852b34$22183@news1.surfino.com>
In reply to#100908
Pol Hallen:

> Merry Christmas to all :-)
> 
> A (newbie) question: I'd like learn about CGI pyhton script to create
> some utility using http://localhost/python_script01.py
> 
> Something like that:
> 
> #!/usr/bin/python print "Content-type: text/html"
> print print "<html>"
> print "<center>Hello!</center>"
> print "</html>"
> 
> How can I execute a local command (like ls or similar) and show output
> via browser?
> 
> I didn't find enough documentation to work with python and CGI :-/
> 
> Is python not good language to use it with CGI?
> 
> Thanks for help! :)
> 
> Pol

http://www.fullstackpython.com/



-- 
Maitu Zentz

[toc] | [prev] | [next] | [standalone]


#100911

FromLaurent Delacroix <laurent@krutt.org>
Date2015-12-27 18:59 +0100
Message-ID<n5p8ue$ajo$1@speranza.aioe.org>
In reply to#100908
On 26/12/15 10:41, Pol Hallen wrote:
> 
> How can I execute a local command (like ls or similar) and show output 
> via browser?
> 

Either you use a proper web framework (Flask, Bottle, Django in order of
complexity) or you set up a web server with FastCGI support (e.g. nginx)
and run a WSGI application behind it.

Useful link:
https://docs.python.org/2/howto/webservers.html#setting-up-fastcgi

Lau

[toc] | [prev] | [next] | [standalone]


#100914

FromChris Warrick <kwpolska@gmail.com>
Date2015-12-27 21:01 +0100
Message-ID<mailman.34.1451246484.11925.python-list@python.org>
In reply to#100911
On 27 December 2015 at 18:59, Laurent Delacroix <laurent@krutt.org> wrote:
> On 26/12/15 10:41, Pol Hallen wrote:
>>
>> How can I execute a local command (like ls or similar) and show output
>> via browser?
>>
>
> Either you use a proper web framework (Flask, Bottle, Django in order of
> complexity) or you set up a web server with FastCGI support (e.g. nginx)
> and run a WSGI application behind it.
>
> Useful link:
> https://docs.python.org/2/howto/webservers.html#setting-up-fastcgi
>
> Lau
> --
> https://mail.python.org/mailman/listinfo/python-list

Better yet, use a real WSGI server like uWSGI and its associated nginx
module. (there are plenty of tutorials around the Internet)

-- 
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web