django는apache2.4 python3.5(검증) 또는 3.x(미검증) 버전에 오류가 발생했습니다.
[Mon Jul 25 20:10:41.247841 2016] [wsgi:error] [pid 18106] mod_wsgi (pid=18106): Call to 'site.addsitedir()' failed for '(null)', stopping.
[Mon Jul 25 20:10:41.247874 2016] [wsgi:error] [pid 18106] mod_wsgi (pid=18106): Call to 'site.addsitedir()' failed for '/home/ling/django_project/lib/python3.5/site-packages'.
[Mon Jul 25 20:10:47.198769 2016] [wsgi:error] [pid 18106] mod_wsgi (pid=18106): Call to 'site.addsitedir()' failed for '(null)', stopping.
[Mon Jul 25 20:10:47.198806 2016] [wsgi:error] [pid 18106] mod_wsgi (pid=18106): Call to 'site.addsitedir()' failed for '/home/ling/django_project/lib/python3.5/site-packages'.
[Mon Jul 25 20:10:47.444672 2016] [wsgi:error] [pid 18106] [remote 192.168.1.2:52125] mod_wsgi (pid=18106): Target WSGI script '/home/ling/django_project/project/simple_project/simple_project/wsgi.py' cannot be loaded as Python module.
[Mon Jul 25 20:10:47.444717 2016] [wsgi:error] [pid 18106] [remote 192.168.1.2:52125] mod_wsgi (pid=18106): Exception occurred processing WSGI script '/home/ling/django_project/project/simple_project/simple_project/wsgi.py'.
。。。 。。。
The reference to debugging logging code was related to me commenting out logging code in mod_wsgi itself to verify where the issue was coming from, not disabling logging of your own.
Do be aware that any mod_wsgi packages shipped by Debian and Ubuntu are unsupported by Debian or Ubuntu and neither do I support them as they ship out of date ancient versions which are many releases behind. It is basically a myth that in a LTS version of those Linux distributions that they provide support. They don’t, they only do that for certain core packages and not the majority of stuff you might install. If you always use only system provided packages in the belief that they are supported, then the reality is that they aren’t.
As to a workaround, it depends on what paths you are trying to add. If you had something like:
WSGIDaemonProcess [...] python-path=/home/srittau/.virtualenvs/foo/lib/python3.5/site-packages:/home/srittau/foo/bar/pylibs
where one path is that related to a virtual environment, it isn’t the preferred way anyway. For a virtual environment you should use python-home option to specify the root of the virtual environment and not use python-path to specify the site-packages directory. Thus should use:
WSGIDaemonProcess [...] python-home=/home/srittau/.virtualenvs/foo python-path=/home/srittau/foo/bar/pylbs
Thus if the reason for two paths was because of one being the virtual environment, change it to the preferred setup and you should be good. If you are adding multiple directories for other reasons, this will not help and the only other option is to add the paths as part of the WSGI script file
총결산
사실 오류가 발생한 원인은python-path 경로를 사용하여 가상 환경을 지정할 수 없기 때문이다.python-home 경로를 사용해야 합니다. 그렇지 않으면 가상 환경을 통해python 응용 프로그램을 불러올 수 없습니다.
내 구성을 참조로 첨부합니다(내부 네트워크 구성 - 192.168.1.2를 도메인 이름으로 변경).
ServerName 192.168.1.2
ServerAdmin [email protected]
Alias /media/ /home/ling/django_project/project/simple_project/media/
Alias /static/ /home/ling/django_project/project/simple_project/blog/static/
Require all granted
Require all granted
WSGIScriptAlias / /home/ling/django_project/project/simple_project/simple_project/wsgi.py
WSGIDaemonProcess 192.168.1.2 python-path=/home/ling/django_project/project/simple_project python-home=/home/ling/django_project/lib/python3.5/site-packages
WSGIProcessGroup 192.168.1.2
Require all granted
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Django 라우팅 계층 URLconf 작용 및 원리 해석URL 구성(URLconf)은 Django가 지원하는 웹 사이트의 디렉토리와 같습니다.그것의 본질은 URL과 이 URL을 호출할 보기 함수 사이의 맵표입니다. 위의 예제에서는 URL의 값을 캡처하고 위치 매개 변수로...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.