Unable to retrieve files from send_from_directory() in flask

前端 未结 5 806
忘掉有多难
忘掉有多难 2020-12-09 16:47

I have a html file which references static object like this



         


        
5条回答
  •  伪装坚强ぢ
    2020-12-09 17:19

    Don't use Flask's built-in server in production. It is for development only! And don't use Flask to serve static assets. It's slow! In production use a webserver in front of Flask like apache2, nginx or lighttpd. These servers are able to rewrite a URL and serve static assets.

    How to deploy Flask: http://flask.pocoo.org/docs/deploying/

    How to rewrite a URL: apache2, nginx, lighttpd.

提交回复
热议问题