问题
I want to serve static files with Python. Is the Python 3 http.server
suitable for use in production? If not, why not? And what are my alternatives?
回答1:
Quoting documentation https://docs.python.org/3/library/http.server.html#module-http.server
Warning: http.server is not recommended for production. It only implements basic security checks.
First of all you don't need python at all to serve static files. Just use a real HTTP Server like Apache or NGinx. If you want a quick solution just look for a docker container with a pre-configured image suitable for your needs. Here is the NGinx. Definitely docker is a must have tool that you will not regret to learn.
$ docker run --name mysite-nginx -v /mysite:/usr/share/nginx/html:ro -p 80:80 -d nginx
来源:https://stackoverflow.com/questions/33392293/python-simplehttpserver-in-production