简体   繁体   English

在Apache服务器上部署Django

[英]Deploying Django on an apache server

I am new to web development. 我是网络开发的新手。 So be gentle. 所以要温柔。 AND thanks in advance. 并提前感谢。 I am developing on windows env. 我正在开发windows env。 and deploying on a linux server w/ Python 2.6.2 installed. 并在安装了Python 2.6.2的Linux服务器上部署。 Running apache2.2 as Virtual Host, and I am using mod_wsgi. 将apache2.2作为虚拟主机运行,我使用的是mod_wsgi。 I plan to serve media files from the same Virtual Host. 我计划从同一个虚拟主机提供媒体文件。

I have a django site and I am now ready to deploy. 我有一个django站点,我现在准备部署。 I am stuck, and every site I go to seems to be outdated/incomplete/overmyhead. 我被卡住了,我去的每个网站似乎都过时/不完整/过头了。

https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/ https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/

http://www.djangobook.com/en/2.0/chapter12/ http://www.djangobook.com/en/2.0/chapter12/

...only 2 links as for the newbness ...对于newbness只有2个链接

The top link seems to be what I need yet I am still confused on these things: 顶部链接似乎是我需要的,但我仍然对这些事情感到困惑:

  1. What does the file structure look like on the server 文件结构在服务器上的外观如何
    • I cannot change/edit server files myself, I rely on the dba for that 我自己无法更改/编辑服务器文件,我依赖于dba
    • I have django.wsgi, and django.wsgi~, where do those go? 我有django.wsgi和django.wsgi~,那些去哪儿了?
    • Where do I put my project in relation to those wsgi files? 我在哪里将项目与wsgi文件相关联?

  2. The httpd.conf file is something that the server has on it? httpd.conf文件是服务器上的文件吗? or do I create another? 还是我创造另一个?

  3. Do I need to put django in any way shape or form on the server? 我是否需要在服务器上以任何形式或形式放置django? If so where? 如果是这样的话? And what about the packages like registration, defaults? 那么像注册,默认等包呢?

Again sorry for the newbness, I have been banging my head for 2 weeks on this. 再次为这个新闻感到抱歉,我一直在敲打我的头两周。 Any help/links will be greatly appreciated unless they link me to the django-docs. 除非他们将我链接到django-docs,否则将非常感谢任何帮助/链接。 I have read those...A LOT! 我读过那些......很多! thanks 谢谢

  1. It doesn't matter where the files go. 文件的去向无关紧要。 They just have to be readable/executable by the user that the web server is running under. 它们只需要由运行Web服务器的用户可读/可执行。 I don't know what you mean by django.wsgi~ , that sounds like a backup file created by your editor - you don't need that. 我不知道你的意思是django.wsgi~ ,这听起来像是你的编辑器创建的备份文件 - 你不需要它。

  2. Yes the httpd.conf is the configuration file for Apache. 是的,httpd.conf是Apache的配置文件。 Some distributions (eg Debian and Ubuntu) split this up into separate files for each site that the server runs. 某些发行版(例如Debian和Ubuntu)将其拆分为服务器运行的每个站点的单独文件。 If your administrator is the only one who can edit files, he will know about this already. 如果您的管理员是唯一可以编辑文件的人,他就会知道这一点。

  3. Yes, you need Django, and any third-party packages. 是的,你需要Django和任何第三方软件包。

Also go read: 另请阅读:

http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

and watch: 并观看:

http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations

The latter includes Django examples and talks a bit about locations, permissions etc. 后者包括Django示例,并谈谈位置,权限等。

The first of these is even linked to in the document in the Django documentation. 其中第一个甚至与Django文档中的文档相关联。

@Nathan @Nathan

An easier option for you while you are learning this is not to really have to many expenses. 当你学习这个时,一个更容易的选择并不是真的需要很多费用。

I could also suggest you take a look at Heroku - allows you to easily deploy your applications in minutes. 我还建议你看看Heroku - 允许你在几分钟内轻松部署你的应用程序。

Up until recently they only supported RoR and they have brought in support for Django and Python - they have some really well documented tutorials as well. 直到最近,他们只支持RoR,他们已经支持Django和Python - 他们也有一些非常好的文档教程。

I hope this helps 我希望这有帮助

Heroku Django / Python tutorial Heroku Django / Python教程

I have written up an simple deployment guide for django applications it can be found here . 我已经为django应用程序编写了一个简单的部署指南,可以在这里找到它。 It goes all the way from project setup and deployment. 它从项目设置和部署开始。 I also have references setup. 我也有参考设置。 I honestly believe it answers all your questions, I would give it a look. 我真的相信它会回答你所有的问题,我会试一试。

Goodluck. 祝好运。

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

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