我已按照instructions on Django website在CentOS 7服务器上使用我的Django应用程序配置Apache。这包括从源码构建mod_wsgi以与已安装的python3.4一起工作。如何配置Apache以与Django一起工作
的Apache重启后没有错误,但是当我打我的应用程序的URL http://example.com/myapp/
我得到一个503错误,如:
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Apache/2.2.15 (CentOS) Server at example.com Port 80
我不知道我该怎么解决什么是错在这里。谁能帮忙?该配置的
详情:
我的Django应用程序住在/ mnt/NET/Django的/ MYAPP
我已经添加了文件wsgi.conf到我的Apache conf.d目录,它看起来像这样的:
#LoadModule wsgi_module modules/mod_wsgi.so
# use python34 pip installes mod_wsgi
LoadModule wsgi_module "/usr/lib64/python3.4/site-packages/mod_wsgi/server/mod_wsgi-py34.cpython-34m.so"
#WSGIPythonHome "/usr"
Alias /robots.txt /mnt/net/django/myapp/static/robots.txt
Alias /favicon.ico /mnt/net/django/myapp/static/favicon.ico
Alias /media /mnt/net/django/myapp/media/
Alias /static/ /mnt/net/django/myapp/static/
<Directory /mnt/net/django/myapp/static>
Order deny,allow
Allow from all
</Directory>
<Directory /mnt/net/django/myapp/media>
Order deny,allow
Allow from all
</Directory>
# Allows URLs like example.com/myapp to forward to django
WSGIScriptAlias /myapp /mnt/net/django/myapp/myappsite/wsgi.py process-group=example.com
# Use the virtual env for the myapp site
#WSGIPythonHome /mnt/net/django/myapp/env-myapp-py3-4
# Need to use WSGIDaemon
WSGIDaemonProcess example.com python-home=/mnt/net/django/myapp/env-myapp-py3-4 python-path=/mnt/net/django/myapp
#WSGIPythonPath /mnt/net/django/myapp
<Directory /mnt/net/django/myapp/myappsite>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
你尝试阅读文档,这对与Apache部署非常详细的说明?请注意,代理开发服务器是非常明智的做法:开发服务器就是这样,仅用于开发。 –
你是怎么安装mod_wsgi的,安装yum? mod_wsgi必须针对您开发Django时使用的相同版本的Python进行编译。 – FlipperPA
是的。我做了一个yum安装。由于我必须通过构建它来安装python 3.5,所以我认为我也必须构建mod_wsgi。谢谢。 – dam