在Apache2上为Django部署配置mod_wsgi后,我得到了404错误。Django部署Apache2上配置mod_wsgi后出现404错误
ENV:Ubuntu服务器14.04.2LTS/Apache的2.4/1.8的Django/Python的3.4
我的apache2.conf是如下(内容我在conf文件的末尾添加):
AddHandler cgi-script .cgi .pl .py
WSGIScriptAlias//var/www/html/youknowmanagementsystem/youknow/wsgi.py
WSGIPythonPath /var/www/html/youknowmanagementsystem
Alias /static/ /var/www/html/youknowmanagementsystem/statics/
<Directory /var/www/html/youknowmanagementsystem/statics>
Require all granted
</Directory>
<Directory /var/www/html/youknowmanagementsystem/youknow>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
我检查了我的Apache2错误日志,它表明:
[Thu Apr 23 21:30:52.253785 2015] [mpm_prefork:notice] [pid 5562] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.9 mod_wsgi/3.4 Python/3.4.0 configured -- resuming normal operations
[Thu Apr 23 21:30:52.253836 2015] [core:notice] [pid 5562] AH00094: Command line: '/usr/sbin/apache2'
[Thu Apr 23 21:56:06.006229 2015] [:error] [pid 5566] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'>
[Thu Apr 23 21:56:06.006263 2015] [:error] [pid 5566] Traceback (most recent call last):
[Thu Apr 23 21:56:06.006269 2015] [:error] [pid 5566] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown
[Thu Apr 23 21:56:06.006648 2015] [:error] [pid 5566] assert tlock is not None
[Thu Apr 23 21:56:06.006658 2015] [:error] [pid 5566] AssertionError:
[Thu Apr 23 21:56:06.013870 2015] [:error] [pid 5570] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'>
[Thu Apr 23 21:56:06.013900 2015] [:error] [pid 5570] Traceback (most recent call last):
[Thu Apr 23 21:56:06.013907 2015] [:error] [pid 5570] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown
[Thu Apr 23 21:56:06.014285 2015] [:error] [pid 5570] assert tlock is not None
[Thu Apr 23 21:56:06.014295 2015] [:error] [pid 5570] AssertionError:
[Thu Apr 23 21:56:06.017918 2015] [:error] [pid 5569] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'>
[Thu Apr 23 21:56:06.017945 2015] [:error] [pid 5569] Traceback (most recent call last):
[Thu Apr 23 21:56:06.017952 2015] [:error] [pid 5569] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown
[Thu Apr 23 21:56:06.018337 2015] [:error] [pid 5569] assert tlock is not None
[Thu Apr 23 21:56:06.018346 2015] [:error] [pid 5569] AssertionError:
[Thu Apr 23 21:56:06.021742 2015] [:error] [pid 5586] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'>
[Thu Apr 23 21:56:06.021772 2015] [:error] [pid 5586] Traceback (most recent call last):
[Thu Apr 23 21:56:06.021778 2015] [:error] [pid 5586] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown
[Thu Apr 23 21:56:06.022339 2015] [:error] [pid 5567] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'>
[Thu Apr 23 21:56:06.022357 2015] [:error] [pid 5567] Traceback (most recent call last):
[Thu Apr 23 21:56:06.022362 2015] [:error] [pid 5567] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown
[Thu Apr 23 21:56:06.022737 2015] [:error] [pid 5567] assert tlock is not None
[Thu Apr 23 21:56:06.022748 2015] [:error] [pid 5567] AssertionError:
[Thu Apr 23 21:56:06.024135 2015] [:error] [pid 5568] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'>
[Thu Apr 23 21:56:06.024158 2015] [:error] [pid 5568] Traceback (most recent call last):
[Thu Apr 23 21:56:06.024163 2015] [:error] [pid 5568] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown
[Thu Apr 23 21:56:06.024535 2015] [:error] [pid 5568] assert tlock is not None
[Thu Apr 23 21:56:06.024545 2015] [:error] [pid 5568] AssertionError:
[Thu Apr 23 21:56:06.027435 2015] [:error] [pid 5586] assert tlock is not None
[Thu Apr 23 21:56:06.027462 2015] [:error] [pid 5586] AssertionError:
[Thu Apr 23 21:56:06.085916 2015] [mpm_prefork:notice] [pid 5562] AH00169: caught SIGTERM, shutting down
[Thu Apr 23 21:56:07.053702 2015] [mpm_prefork:notice] [pid 5768] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.9 mod_wsgi/3.4 Python/3.4.0 configured -- resuming normal operations
[Thu Apr 23 21:56:07.053749 2015] [core:notice] [pid 5768] AH00094: Command line: '/usr/sbin/apache2'
我怎样才能解决这个404错误?请让我知道,如果我可以提供更多detials。
您没有404错误。 –
@DanielRoseman你是指这个细节?未找到 在此服务器上未找到请求的URL /。 Apache/2.4.7(Ubuntu)Server at 127.0.0.1 Port 8002 – JordanChina