python - create a download command with web.py -


I am new to the web.py, and I try to create a download command.

I make it one:

  import ur urls = ('/', 'index', '/ download', 'download') category index: def GET (self): Return "Hello, world!" Class Download: DEF GET (Self): Path = 'http: \ Localhost: 8080 \ C: \ 11 \ 229077_6482396906_558_n.jpg' Web Ideaire ('Content Dishes', 'Attachment; Filename =' FNAEext '') Web.header ('Content-Type', 'Picture / JPEG') web.header ('Content-Transfer-Encoding', 'Binary') Return Open (path, 'RB'). Read () if __name__ == "__man__": app = web Application (URL, Globals ()) app. Rn ()   

And I have two main problems:

  1. When I type Http: // localhost: 8080 / download , why do I give 500 internal server errors?

  2. I can choose which file I would like to download (just manually change the path logic) How can I give this function to external logic? 500 is the common error code, which is a common error code, so it is hard to diagnose when setting your code, I will check my URI in the browser to determine if your server is running properly or not. Full list of error codes -

  3. You can only find files that have links pointing to them, for example,

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -