【发布时间】:2020-01-10 08:25:42
【问题描述】:
我想问是否有办法将我的 Flask 项目部署到 Plesk 子域。该站点将在 Plesk 中使用 wordpress 创建。另外,我想有数据库支持。
【问题讨论】:
我想问是否有办法将我的 Flask 项目部署到 Plesk 子域。该站点将在 Plesk 中使用 wordpress 创建。另外,我想有数据库支持。
【问题讨论】:
我正在努力解决类似的问题。我所做的如下:
将以下内容添加到附加 nginx 指令中:
location / {
# Define the location of the proxy server to send the request to
proxy_pass http://127.0.0.1:5000;
# Redefine the header fields that NGINX sends to the upstream server
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Define the maximum file size on file uploads
client_max_body_size 5M;
}
location /static/ {
alias /var/www/vhosts/PATH/TO/FLASK/app/static/;
}
剩下的由 gunicorn 处理,你可以在这里找到一个很棒的教程:https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvii-deployment-on-linux
希望对你有帮助
【讨论】: