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


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

Re: 404 Error when using local CGI Server

Started byChris Angelico <rosuav@gmail.com>
First post2015-06-25 20:02 +1000
Last post2015-06-25 20:02 +1000
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: 404 Error when using local CGI Server Chris Angelico <rosuav@gmail.com> - 2015-06-25 20:02 +1000

#93127 — Re: 404 Error when using local CGI Server

FromChris Angelico <rosuav@gmail.com>
Date2015-06-25 20:02 +1000
SubjectRe: 404 Error when using local CGI Server
Message-ID<mailman.53.1435226544.3674.python-list@python.org>
On Thu, Jun 25, 2015 at 3:48 AM, Charles Carr <chcarr@sas.upenn.edu> wrote:
> I am running a local cgi server from python on a windows 7 computer.
> Whenever I try to serve the output of a cgi file by entering the following
> into my browser: http://localhost:8080/filename.py , I get a 404 error
> message that the file was not found. I'm positive that the files I am trying
> to serve are in the same directory as the server script that is running. Are
> there any tips as to where I should save my files in order to avoid this
> error?

It depends entirely on how your server is set up. What I would
recommend is completely ignoring the file system, and designing a web
site using one of the frameworks that are available for Python, such
as Flask or Django. Your URLs are defined in your code; you can have a
'static' directory from which simple files (images, CSS, etc) get
served, but the file system does not define executable entry points.
This avoids the *massive* problems of PHP, where an attacker can
upgrade a file delivery exploit into remote code execution; the worst
that can happen with Python+Flask+static is that the file gets
uploaded into static/ and is then available as-is for download (it
won't be run on the server).

ChrisA

[toc] | [standalone]


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


csiph-web