Python3 http.server.SimpleHTTPRequestHandler static files

Tal Bar-Or tbaror at gmail.com
Thu Mar 3 02:38:04 EST 2016


Hello All,
I need to create simple web server i am using following http.server.SimpleHTTPRequestHandler The class along with the web content is as follows structure
main folder | 
 |_httplocal <web content folder |files and python module
 [.] [..] app.js [AvRescue] bower.json [bower_components] [img] index.html
remediationstat.json style.css LocalUiHttp.py [__pycache__]
from main script i import it as follows , which reside on main folder
from localhttp import LocalUiHttp
The module i wrote is as follows below , the issue i have is that when i am init the class and from browser i get directory listing instead of the index.html and other content i have My question is how can specify to the web where the content reside? Please advice Thanks
class LocalUI:
 def HttpLocalSrv(self):
 PORT = 8000
 Handler = http.server.SimpleHTTPRequestHandler
 httpd = socketserver.TCPServer(("", PORT), Handler)
 print("serving at port", PORT)


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /