简体   繁体   English

为Django配置mod_wsgi?

[英]Configuring mod_wsgi for Django?

I have configure mod_wsgi along with Apache 2 and tested with my Debain Squeeze 6. I need to put my code under /var/www directory as a extension .wsgi. 我已经与Apache 2一起配置了mod_wsgi并通过Debain Squeeze 6进行了测试。我需要将代码作为扩展名.wsgi放在/ var / www目录下。 Now, I want to configure Django with mod_wsgi. 现在,我想用mod_wsgi配置Django。 How do I do it? 我该怎么做? Do I put my every files under /var/www. 我是否将每个文件都放在/ var / www下。 Is there a security issue or something? 有安全性问题吗? Can someone tell me step by step to configure django with mod_wsgi and where would be better to put the DJango codes? 有人可以一步一步告诉我,用mod_wsgi配置django,在哪里放置DJango代码会更好? Thank you! 谢谢! PS I have intermediate Django knowledge. PS我有中级Django知识。

Here are a couple of links that you can use. 这是您可以使用的几个链接。 The first one has proven the most useful for me as it is very detailed! 第一个对我来说最有用,因为它非常详细!

Hope it helps! 希望能帮助到你!

EDIT: 编辑:

Regarding security, as long as you provide access to the apache user (or www-data, depending on your linux distribution) (chown and chgrp) for all files in your /var/www/html/your_django_project you should not have any issues. 关于安全性,只要您为/ var / www / html / your_django_project中的所有文件提供对apache用户(或www-data,取决于您的Linux发行版)(chown和chgrp)的访问,就不会有任何问题。 Do NOT run anything as superuser. 不要以超级用户身份运行任何程序。

Be careful to allow the apache user to write your log files, wherever they are. 小心允许apache用户在任何位置写您的日志文件。 You could get irrelevant errors which could be caused by that. 您可能会得到与此无关的错误。

Also, setup apache to serve django media files if you don't want to end up with media-less pages :-) 另外,如果您不想以无媒体页面结尾,请设置apache来提供Django媒体文件:-)

文档站点上有一个很好的说明集。

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

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