部署Flask应用程序到godaddy托管

2024-04-30 03:14:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用Python/烧瓶微结构。(http://flask.pocoo.org/)来构建一个小型应用程序。在本地测试了应用程序并将其部署到godaddy,在那里,当转到URL时,我看到“错误400”。我打电话给他们的技术支持,他们说应用程序需要index.html页面,他们的平台不支持python。这里是我加载页面“服务内容”。

mAIN.PY

仅供参考,它在我的本地机器上运行得很好,我还有一个由AMAZON/EC2托管的实例,它运行得很好。

还有人有这个问题吗?有谁能帮我弄明白为什么这不管用吗?


Tags: org应用程序httpurlflaskindex烧瓶部署
2条回答

这有点棘手。我要开一个私人豪华帐户。我找到的唯一方法是安装Python 3.x,然后安装virtualenv,然后使用pip install requirements.txt安装我需要的内容

在共享环境中意味着您很可能需要使用CGI来部署:

http://flask.pocoo.org/docs/deploying/cgi/

On shared webhosting, though, you might not have access to your Apache config. In this case, a file called .htaccess, sitting in the public directory you want your app to be available, works too but the ScriptAlias directive won’t work in that case:

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f # Don't interfere with static files RewriteRule ^(.*)$ /path/to/the/application.cgi/$1 [L]

相关问题 更多 >