Django 앱을 운이없는 Apache 서버에 배포하려고합니다. 나는 WSGI 샘플 애플리케이션을 성공시키고 빈 Django 프로젝트를 호스트하려고 시도했다.아파치와 wsgi가있는 Django가 ImportError를 던졌습니다.
"""
WSGI config for myapp project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
난에 wsgi.conf 있습니다
[notice] Apache/2.2.22 (Debian) PHP/5.4.4-14+deb7u9 mod_python/3.3.1 Python/2.7.3 mod_wsgi/2.7 configured -- resuming normal operations
[error] [client x.x.x.x] mod_wsgi (pid=8300): Exception occurred processing WSGI script '/usr/local/www/django/myapp/wsgi.py'.
[error] [client x.x.x.x] Traceback (most recent call last):
[error] [client x.x.x.x] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
[error] [client x.x.x.x] self.load_middleware()
[error] [client x.x.x.x] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 44, in load_middleware
[error] [client x.x.x.x] for middleware_path in settings.MIDDLEWARE_CLASSES:
[error] [client x.x.x.x] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 54, in __getattr__
[error] [client x.x.x.x] self._setup(name)
[error] [client x.x.x.x] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 49, in _setup
[error] [client x.x.x.x] self._wrapped = Settings(settings_module)
[error] [client x.x.x.x] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in __init__
[error] [client x.x.x.x] % (self.SETTINGS_MODULE, e)
[error] [client x.x.x.x] ImportError: Could not import settings 'myapp.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named myapp.settings
내 wsgi.py은 다음과 같다 :가 manage.py의 runserver 제대로 작동하지만 아파치를 사용하는 경우, 다음과 같은 오류가 발생합니다 아파치에 대한 conf.d 라이브러리 :
<VirtualHost *:80>
ServerName myapp.example.com
ServerAlias myapp
ServerAdmin [email protected]
DocumentRoot /var/www
<Directory /usr/local/www/django>
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess myapp processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup myapp
WSGIScriptAlias /myapp /usr/local/www/django/myapp/wsgi.py
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
</VirtualHost>
WSGIPythonPath /usr/local/www/django/myapp
[SOLVED] 감사합니다, 나는 모든 것을 다시 시작 내 구성 파일에 제안 된 수정을했고, 지금은 일하고있어. 두 가지 제안을 모두 올바르게 표시 할 수는 없었지만 두 가지 모두 필요하다고 생각하고 다시 설치 한 후 사라지는 세 번째 (네 번째, 다섯 번째 ...) 버그가있었습니다.
앱 레이아웃은 무엇입니까? 정확히 설정 파일은 어디에 있습니까? –
앱 레이아웃은 django가 생성 한 레이아웃입니다. –
그렇다면 settings.py에 대한 전체 파일 경로 *는 무엇입니까? –