Path: csiph.com!news.mixmin.net!news2.arglkargh.de!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'configure': 0.04; 'subject:help': 0.07; 'cc:addr:python-list': 0.09; 'creation,': 0.09; 'django,': 0.09; 'editor.': 0.09; '\xe2\x80\x94': 0.09; 'python': 0.10; 'python.': 0.11; 'apache': 0.14; 'subject:python': 0.14; 'everyone,': 0.15; 'server,': 0.15; 'http.server': 0.16; 'out?': 0.16; 'subject:run': 0.16; 'url:djangoproject': 0.16; 'wrote:': 0.16; 'frameworks': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'cc:no real name:2**0': 0.22; 'code,': 0.23; 'code.': 0.23; 'advance.': 0.23; 'examples': 0.24; 'header:In-Reply-To:1': 0.24; 'header': 0.24; "doesn't": 0.26; 'command': 0.26; 'chris': 0.26; 'figure': 0.27; 'message-id:@mail.gmail.com': 0.27; 'that.': 0.30; 'url:mailman': 0.30; 'anyone': 0.32; 'run': 0.33; 'url:python': 0.33; 'http': 0.33; 'url:listinfo': 0.34; 'server': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'instead': 0.36; 'url:org': 0.36; 'framework': 0.36; 'urls': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'things': 0.38; 'listing': 0.38; 'manual': 0.38; 'files': 0.38; 'url:en': 0.39; 'url:mail': 0.40; 'subject:with': 0.40; 'your': 0.60; 'personally': 0.61; 'show': 0.62; 'safe': 0.63; 'else.': 0.66; 'guides': 0.72; 'click': 0.76; 'extensions.': 0.84; 'urls,': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=B45uFPqBXlN0eelmqLKKGQpzUGfv2heNv2E9Zs6tiQo=; b=Isb8MWoJyTQd1VtTWrHlCaVvvXlk4vUiLsJKlvwt2loeag99U4inVKzDyvD6ZQ+YpH xTmPVH6SRDxmP8x1xWWMtyYe+Dg7EB88a5geMRLy9HmNc0HryOo4SJMZLKud7WCpmvAH UDNGDVNgcHRor+pgS2bKxcl1Uxhuf1uOynL1cXPuQe+vryUrcJZv6KRMhGzjGNjYk2uI 4rT3qeZ1nG2m6M0nOlbTb15SzKMUd9l1guXCrd0OpdePndX5URPS7s3NsD3ia7G7eCJA lnqCc5Wr+FMPlOFX0XSI4QKGX18ADE5vTt7qF/wvRps2QXSNWGFnFFMNNAAX50dFpMJm rtHA== MIME-Version: 1.0 X-Received: by 10.52.176.195 with SMTP id ck3mr18514733vdc.78.1441541797867; Sun, 06 Sep 2015 05:16:37 -0700 (PDT) In-Reply-To: <3877a9ae-edbd-4d36-925a-5cb3789bd1bd@googlegroups.com> References: <3877a9ae-edbd-4d36-925a-5cb3789bd1bd@googlegroups.com> Date: Sun, 6 Sep 2015 14:16:37 +0200 Subject: Re: Can anyone help me run python scripts with http.server? From: Chris Warrick To: tropical.dude.net@gmail.com Cc: python-list@python.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1441541806 news.xs4all.nl 23724 [2001:888:2000:d::a6]:33842 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96057 On 6 September 2015 at 13:50, 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=E2=80=99t use http.server. Don=E2=80=99t use CGI. This is not how thing= s work in Python. In Python, you should use a web framework to write your code. Web frameworks include Flask, Django, Pyramid=E2=80=A6 Find one that=E2=80=99s = popular and that you like, and learn that. You won=E2=80=99t have any `.py` URLs, inste= ad you will have modern pretty URLs with no extensions. And a lot of things will be abstracted =E2=80=94 no manual header creation, help with sa= fe 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/ --=20 Chris Warrick PGP: 5EAAEA16