Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93127
| References | <CAKDUBcvmfCy45r+Nx+1a7=O3apZLnMTC8V98kOmTmoJnr6=L9A@mail.gmail.com> |
|---|---|
| Date | 2015-06-25 20:02 +1000 |
| Subject | Re: 404 Error when using local CGI Server |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.53.1435226544.3674.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: 404 Error when using local CGI Server Chris Angelico <rosuav@gmail.com> - 2015-06-25 20:02 +1000
csiph-web