简体   繁体   English

如何将Django / Python应用程序公开给Web?

[英]How to expose Django/Python application to the web?

I developed a simple Django/Python poll application(Following step by step tutorial from the Django Official Documentation). 我开发了一个简单的Django / Python轮询应用程序(按照Django官方文档中的分步教程)。 I used the in build server to test the application. 我使用构建服务器来测试应用程序。 Now, I want to host my application in the web. 现在,我想在网络上托管我的应用程序。 I heard WSGI is the best way to expose Python/Django application to the web? 我听说WSGI是将Python / Django应用程序暴露给Web的最佳方式吗? What would be the best way to expose Python/Django code into the web? 将Python / Django代码暴露给Web的最佳方法是什么? Thank you 谢谢

PS: I already have a domain name and a shared web hosting from justhost.com. PS:我已经有了一个域名和一个来自justhost.com的共享虚拟主机。 While I chat to their support, they told me that they support WSGI. 当我与他们的支持聊天时,他们告诉我他们支持WSGI。

I'd go for Heroku . 我会去Heroku They have a free usage quota, and a really nice deployment mechanism. 他们有免费的使用配额,以及非常好的部署机制。 Here's a nice article describing how to use it: https://devcenter.heroku.com/articles/django 这篇文章描述了如何使用它: https//devcenter.heroku.com/articles/django

Easiest way to do that is to find a host online (such as pythonanywhere.com) to host your app on there, following their instructions, and your app will be online. 最简单的方法是在线找到一个主机(例如pythonanywhere.com),按照他们的指示在那里托管你的应用程序,你的应用程序将在线。 They handle most of the issues with piggybacking a django project on a server. 他们通过在服务器上搭载django项目来处理大多数问题。

You need a HTTP server program like Apache or NGINX to serve your http requests. 您需要一个HTTP服务器程序,如Apache或NGINX来为您的http请求提供服务。 There will be a module like fastCGI or the better WSGI to interact with your python scripts/environment. 将有一个类似fastCGI的模块或更好的WSGI来与您的python脚本/环境进行交互。 These HTTP server programs and databases will be on a web host machine that you can rent that also provides static IPs and domain name resolution. 这些HTTP服务器程序和数据库将位于您可以租用的Web主机上,该机器还提供静态IP和域名解析。 For Django I can highly recommend WebFaction , they support it and have good documentation . 对于Django,我强烈推荐WebFaction ,他们支持它并拥有良好的文档 You will probably also need to register a domain name via a registrar if you dont want to use the sample subdomain provided by your web host. 如果您不想使用Web主机提供的示例子域,您可能还需要通过注册商注册域名。

Update: for justhost, see this related question . 更新:对于justhost,请参阅此相关问题

部署如何在文档列表中支持部署django的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM