运行一个烧瓶服务器 [英] Running a flask server

查看:177
本文介绍了运行一个烧瓶服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,可能是一个愚蠢的问题,但我开始学习这一切,所以你的反馈将是宝贵的我。



问题是:在 flask 这个文档说,通过输入命令'python hello.py '我成功地看到localhost:5000上的输出。现在,我有一个共享的托管计划,如果我上传这个文件,那么我需要在那里启动服务器?如果是这样,当我关闭在那里终端,烧瓶服务器关闭(因为当我关闭我的电脑终端关闭烧瓶服务器和结果是没有更多的localhost:5000)?告诉我,我必须一直运行终端。请告诉我这里的基本想法是什么?感谢。

解决方案

您所要求的是如何部署您的应用程序。有很多选择,这将取决于您的需求,您的托管服务等。

您应该检查烧瓶文档的选项。 http://flask.pocoo.org/docs/deploying/



从本质上来说,你的烧瓶应用程序将作为服务器上的本地服务来运行,所以当你关闭终端时它不会被关闭,而HTTP服务器会以某种方式代理对该服务的请求。我猜最受欢迎的是带有nginx的uWSGI。


So, probably a dumb question, but I am beginning to learn all this so your feedback will be valuable for me.

The question is: In flask documentation it says start the flask server by entering the command 'python hello.py' and I do it successfully to see the output on localhost:5000. Now, I have a shared hosting plan and if I upload this file over there will i need to initiate the server over there as well like this? If so, when I close the terminal over there, will the flask server shut down (because when I close the terminal on my computer it shuts down the flask server and the results are no more available on localhost:5000)?.. It basically suggests me that I have to keep running the terminal all the time..please tell me what is the basic idea here? Thanks.

解决方案

What you're asking is how you deploy your app. There are many options, that will depend on your needs, your hosting service, etc.

You should check the flask docs for the options. http://flask.pocoo.org/docs/deploying/

In essence, you'll have your flask app running as a local service on the server, so it's not shut down when you close the terminal, and an HTTP server that somehow proxies requests to that service. I guess the most popular is uWSGI with nginx.

这篇关于运行一个烧瓶服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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