Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #96059
| Path | csiph.com!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'configure': 0.04; 'python3': 0.05; 'skip:p 60': 0.05; 'skip:/ 10': 0.07; 'subject:help': 0.07; 'editor.': 0.09; 'mkdir': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'url:localhost': 0.09; 'python': 0.10; 'apache': 0.14; 'subject:python': 0.14; 'server,': 0.15; '"get': 0.16; "(i'm": 0.16; 'chmod': 0.16; "chris'": 0.16; 'echo': 0.16; 'http.server': 0.16; 'out?': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:run': 0.16; 'url:8000': 0.16; 'url:py': 0.16; 'wrote:': 0.16; 'code,': 0.23; 'script': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'command': 0.26; 'header:X-Complaints-To:1': 0.26; "skip:' 10": 0.28; 'cgi': 0.29; 'minimal': 0.30; 'anyone': 0.32; '[1]': 0.32; 'run': 0.33; 'http': 0.33; 'server': 0.34; 'advice': 0.35; 'could': 0.35; 'but': 0.36; 'instead': 0.36; 'url:non-standard http port': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'listing': 0.38; 'files': 0.38; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'received:de': 0.40; 'hello,': 0.40; 'email addr:gmail.com': 0.62; 'show': 0.62; 'world': 0.64; 'serving': 0.67; 'url:index': 0.67; 'guides': 0.72; 'click': 0.76; '127.0.0.1': 0.84; 'curl': 0.84; 'browser).': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: Can anyone help me run python scripts with http.server? |
| Date | Sun, 06 Sep 2015 14:32:06 +0200 |
| Organization | None |
| References | <3877a9ae-edbd-4d36-925a-5cb3789bd1bd@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | p57bd88de.dip0.t-ipconnect.de |
| User-Agent | KNode/4.13.3 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.173.1441542739.8327.python-list@python.org> (permalink) |
| Lines | 34 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1441542739 news.xs4all.nl 23858 [2001:888:2000:d::a6]:40997 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:96059 |
Show key headers only | View raw
tropical.dude.net@gmail.com wrote:
> I want to use python for web development but I
> could not configure my Apache server to run python
> with the guides I found on the internet.
>
> Can anyone help me configure http.server
> to run python scripts?
>
> I ran the command python -m http.server --cgi to start the http server,
> and if I put index.html, I will see the page but if I use
> index.py, it doesn't show the page, I can only see the
> directory listing of the files and when I click on
> index.py, it doesn't run the code, I can see it just
> like in the editor.
>
> Can anyone help me out?
While in the long run you're better off if you follow Chris' advice here's a minimal cgi script run with http.server
(I'm using curl instead of a browser).
$ mkdir cgi-bin
$ echo -e '#!/usr/bin/env python3\nprint("Content-type:text/plain")\nprint()\nprint("Hello, world")' > cgi-bin/index.py
$ chmod u+x cgi-bin/index.py
$ python3 -m http.server --cgi &
[1] 12345
$ Serving HTTP on 0.0.0.0 port 8000 ...
$ curl http://localhost:8000/cgi-bin/index.py
127.0.0.1 - - [06/Sep/2015 14:30:23] "GET /cgi-bin/index.py HTTP/1.1" 200 -
Hello, world
$
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Can anyone help me run python scripts with http.server? tropical.dude.net@gmail.com - 2015-09-06 04:50 -0700
Re: Can anyone help me run python scripts with http.server? Laura Creighton <lac@openend.se> - 2015-09-06 14:15 +0200
Re: Can anyone help me run python scripts with http.server? tropical.dude.net@gmail.com - 2015-09-06 05:35 -0700
Re: Can anyone help me run python scripts with http.server? tropical.dude.net@gmail.com - 2015-09-06 05:38 -0700
Re: Can anyone help me run python scripts with http.server? Laura Creighton <lac@openend.se> - 2015-09-06 14:45 +0200
Re: Can anyone help me run python scripts with http.server? tropical.dude.net@gmail.com - 2015-09-06 06:07 -0700
Re: Can anyone help me run python scripts with http.server? Chris Angelico <rosuav@gmail.com> - 2015-09-06 23:23 +1000
Re: Can anyone help me run python scripts with http.server? Denis McMahon <denismfmcmahon@gmail.com> - 2015-09-06 20:04 +0000
Re: Can anyone help me run python scripts with http.server? Chris Angelico <rosuav@gmail.com> - 2015-09-07 12:48 +1000
Re: Can anyone help me run python scripts with http.server? Laura Creighton <lac@openend.se> - 2015-09-06 17:03 +0200
Re: Can anyone help me run python scripts with http.server? Chris Angelico <rosuav@gmail.com> - 2015-09-07 01:13 +1000
Re: Can anyone help me run python scripts with http.server? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-06 13:11 -0400
Re: Can anyone help me run python scripts with http.server? tropical.dude.net@gmail.com - 2015-09-06 05:42 -0700
Re: Can anyone help me run python scripts with http.server? Chris Warrick <kwpolska@gmail.com> - 2015-09-06 14:16 +0200
Re: Can anyone help me run python scripts with http.server? Laura Creighton <lac@openend.se> - 2015-09-06 14:28 +0200
Re: Can anyone help me run python scripts with http.server? Peter Otten <__peter__@web.de> - 2015-09-06 14:32 +0200
Re: Can anyone help me run python scripts with http.server? Peter Otten <__peter__@web.de> - 2015-09-06 14:43 +0200
Re: Can anyone help me run python scripts with http.server? tropical.dude.net@gmail.com - 2015-09-06 05:47 -0700
csiph-web