简体   繁体   English

如何在不使用mod_wsgi的情况下部署Django

[英]How to deploy Django without mod_wsgi

I'm relatively new to web development, but I have a couple years experience working with python, so I figured I would build my first production site using django. 我是Web开发的新手,但是我有几年使用python的经验,所以我认为我将使用django建立我的第一个生产站点。

I've spent the last few days learning the basics and building a test site running on my local machine. 最近几天,我学习了基础知识并在本地计算机上运行了一个测试站点。 Today, I've been trying to deploy my site to production; 今天,我一直在尝试将网站部署到生产环境中。 however, I've hit a pretty large stumbling block. 但是,我遇到了一个很大的绊脚石。

The django documentation suggests using mod_wsgi for apache deployments. django文档建议将mod_wsgi用于apache部署。 I followed the install instructions here , only to realize that I don't have access to make any changes to apache - I'm currently on a shared hosting plan. 我按照这里的安装说明进行操作,只是意识到我无权对apache进行任何更改-我目前处于共享主机计划中。

Apparently, to perform the install, I would have to upgrade to a VPS plan, which costs a lot more. 显然,要执行安装,我将不得不升级到VPS计划,这要花很多钱。

Any advice for a new web developer trying to get a proof-of-concept web app together (preferably with feedback gathered from real users) on a budget? 对于尝试在预算范围内将概念验证Web应用程序(最好是从真实用户收集的反馈信息)组合在一起的新Web开发人员,有何建议?

I think I have two options: 我认为我有两种选择:

  1. Eat the cost on my current web hosting plan. 吃掉我当前的虚拟主机计划中的费用。 Try to find a cheaper host that specializes in django hosting. 尝试找到便宜的主机,专门从事Django主机。 I've been looking at the following (suggestions here would be wonderful): 我一直在关注以下内容(这里的建议很不错):
    • Heroku Heroku的
    • DigitalOcean DigitalOcean
    • A2Hosting A2Hosting
  2. Try some sort of manual deployment. 尝试某种手动部署。 Is this possible or has anybody ever made this work? 这可能吗,或者有人做过这项工作吗? I can't seem to find any resources about this. 我似乎找不到有关此的任何资源。
    • I was able to install django on my web server and my site just seems like a collection of files at this point. 我能够在Web服务器上安装django,此时我的站点似乎就像是文件的集合。 Can I simply move this directory tree to my site using an ftp? 我可以简单地使用ftp将目录树移动到我的站点吗? And handle the database migration manually? 并手动处理数据库迁移?
    • Can I just run django on my web server via ssh instead of from my local machine? 我是否可以通过ssh而不是从本地计算机在Web服务器上运行django? Essentially just rebuild my site in production? 本质上只是在生产中重建我的网站? I know this isn't a smart idea with a normal production site, but as a proof of concept, I don't mind some downtime if my code is buggy. 我知道对于正常的生产站点来说这不是一个聪明的主意,但是作为概念证明,如果我的代码有错误,我不介意停机。

Thanks! 谢谢!

If you are just starting Heroku is probably perfect for you. 如果您只是刚刚开始, Heroku可能是您的理想选择。 It's super easy to set up, you don't have to handle the server configuration yourself and it has a free tier to do some tests until you are ready to go. 它非常容易设置,您不必自己处理服务器配置,它有一个免费层可以进行一些测试,直到您准备好使用为止。

If you are OK with doing some more advanced server/service configuration, you can use Google Cloud, Azure or AWS. 如果可以进行一些更高级的服务器/服务配置,可以使用Google Cloud,Azure或AWS。 This last one has a one year free tier . 这最后一个有一年免费套餐 If you go this route, I suggest using gunicorn/uwsgi + nginx instead of Apache mod_wsgi. 如果走这条路,我建议使用gunicorn / uwsgi + nginx代替Apache mod_wsgi。

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

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