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


Groups > comp.lang.python > #96057

Re: Can anyone help me run python scripts with http.server?

References <3877a9ae-edbd-4d36-925a-5cb3789bd1bd@googlegroups.com>
Date 2015-09-06 14:16 +0200
Subject Re: Can anyone help me run python scripts with http.server?
From Chris Warrick <kwpolska@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.171.1441541806.8327.python-list@python.org> (permalink)

Show all headers | View raw


On 6 September 2015 at 13:50,  <tropical.dude.net@gmail.com> wrote:
> Hello everyone,
>
> 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?
>
> Thanks in advance.
> --
> https://mail.python.org/mailman/listinfo/python-list

Don’t use http.server. Don’t use CGI. This is not how things work in Python.

In Python, you should use a web framework to write your code. Web
frameworks include Flask, Django, Pyramid… Find one that’s popular and
that you like, and learn that. You won’t have any `.py` URLs, instead
you will have modern pretty URLs with no extensions. And a lot of
things will be abstracted — no manual header creation, help with safe
forms and databases.

And then you will need to figure out how to run it. I personally use
nginx and uwsgi for this, you may need to look for something else.

Examples for Django:

https://docs.djangoproject.com/en/1.8/#first-steps
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/

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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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