在1& 1共享主机(使用CGI)上部署应用程序 [英] Deploy flask application on 1&1 shared hosting (with CGI)

查看:143
本文介绍了在1& 1共享主机(使用CGI)上部署应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用烧瓶web框架为我的体育俱乐部写了一个web应用程序。我使用内置的测试服务器在本地机器上做了所有的事情。



知道他们告诉我在1和1共享的托管网络空间上部署它。他们有Python支持,但它似乎只允许CGI运行python脚本。



我试过这个教程:通过CGI烧瓶



到目前为止,我忽略了重写的东西。对我的CGI脚本的所有请求导致404错误。我在应用程序中修改了404处理程序,返回 request.path 。当我请求/foo/runserver.cgi/它返回/作为输出。我不知道为什么它不服务于索引视图。它不能用于任何视图,我总是得到一个404。



亲切的问候,
Sebastian

解决方案

我找到了一个解决方案!我把 / $ 1 从我的 .htaccess 中留下了一点点,并修改了werkzeug,因为CGI中的环境变量被命名为a在WSGI应用程序中有点不同。我会通知werkzeug开发者,也许他会把我的解决方案包含到werkzeug中。

I've written a web application for my sports club with the flask web framework. I did everything on my local machine with the build-in test server.

Know they told me to deploy it on an 1&1 shared hosting web space. They have python support but it seems like they only allow CGI to run python scripts.

I tried this tutorial: flask via CGI

I ignored the rewrite stuff until now. All requests to my CGI script resulted in a 404 error. I modified my 404 handler in the application to return request.path. When I request /foo/runserver.cgi/ it returns / as output. I have no idea why it doesn't serve the index view. It doesn't work with any view, I always get a 404.

Kind regards, Sebastian

解决方案

I found a solution! I left the /$1 away from my .htaccess and modified werkzeug a bit because the environment variables in CGI are named a bit different the in WSGI applications. I'll inform the werkzeug developer about it and maybe he'll include my solution into werkzeug.

这篇关于在1& 1共享主机(使用CGI)上部署应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆