问题描述
我从下载mod_wsgi的。 (我试图让Django的到我的计算机上运行)。
I downloaded mod_wsgi from the following location for apache 2.2 and python 2.7 (64bit). (I'm trying to get django to run on my computer).
每当我添加以下行:
LoadModule wsgi_module modules/mod_wsgi.so
阿帕奇无法启动。谁能告诉我是什么问题可能是什么?
Apache fails to start up. Can anyone tell me what the issue might be?
推荐答案
这些都是你需要做的配置Apache Django的以下的东西。我假设你使用的是Windows上的Python 2.7( 32位)( 32位)与WAMP服务器( 32位)安装。
These are the following things you need to do to setup Apache for Django. I assume you are using Python 2.7 (32-bit) on Windows (32-bit) with WAMP server (32-bits) installed.
-
mod_wsgi-win32-ap22py27-3.3.so。或下载相应的.so兼容的文件
Download mod_wsgi-win32-ap22py27-3.3.so. Or download your respective .so compatible file
更名为 mod_wsgi.so
并将其复制到 / Program Files文件/阿帕奇软件基金会/ Apache22 /模块
在Windows上。
Change its name to mod_wsgi.so
and copy it to /Program Files/Apache Software Foundation/Apache22/modules
on Windows.
打开的httpd.conf
使用管理员权限。现在,你会发现线路与的LoadModule ...
列表。只需添加的LoadModule wsgi_module模块/ mod_wsgi.so
到列表中。
Open httpd.conf
using Admin rights. Now, you will find a list of lines with LoadModule ...
. Just add LoadModule wsgi_module modules/mod_wsgi.so
to that list.
您是部分完成..你可以重新启动Apache,不应发现任何错误。
Your are partially done.. you can restart the apache and shouldn't find any errors.
现在,你需要将它链接到您的Django项目。
Now you need to link it to your Django project.
在Django项目的根文件夹中添加阿帕奇
文件夹并创建 django.wsgi
(唐' T改变这个名字)和 apache_mydjango.conf
。
In your Django project root folder, add apache
folder and create django.wsgi
(don't change this name) and apache_mydjango.conf
.
在的httpd.conf
添加下面一行在页面的底部。
In httpd.conf
add the following line at the bottom of the page.
包括D:/projects/mysite/apache_django_wsgi.conf
打开 django.wsgi
并添加以下行:
import os, sys
sys.path.append('d:/projects/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
打开 apache_djang_wsgi.conf
并添加:
Alias /images/ "d:/projects/mysite/templates/images/"
<Directory "d:/projects/mysite/images>
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias / "d:/projects/mysite/apache/django.wsgi"
<Directory "d:/projects/mysite/apache">
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot d:/projects/mysite
ServerName 127.0.0.1
</VirtualHost>
请注意:
我假设你的Django项目的层次结构是这样的:
I am assuming your Django project hierarchy is something like this:
mysite/
mysite/
settings.py
urls.py, wsgi.py.
manage.py
<apache> / apache_django_wsgi.conf, django.wsgi
最佳教程链接:
- port25.technet.com | Published my microsoft.
- mod_wsgi Quick Install guide
- Django site
- Django site
的其实我不明白为什么人们无法修复。我在这里看到它的问题很多,我甚至贴出几个。所以,我觉得直接写一个初始安装版本的答案的
这篇关于WAMP的服务器上安装mod_wsgi的Windows 7上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!