mod_wsgiを:私はこれが来ている理由は全くわからないんだけど内部サーバーエラー500はApache 2.4と私は次の出力を得ている私のApacheのエラーログから
[Fri Feb 24 18:44:44.617451 2017] [mpm_winnt:notice] [pid 16752:tid 684] AH00354: Child: Starting 64 worker threads.
[Fri Feb 24 18:44:49.932581 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] mod_wsgi (pid=16752): Target WSGI script 'C:/Users/Rasmus/workspace/MainSite/src/MainSite/wsgi.py' cannot be loaded as Python module.
[Fri Feb 24 18:44:49.932581 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] mod_wsgi (pid=16752): Exception occurred processing WSGI script 'C:/Users/Rasmus/workspace/MainSite/src/MainSite/wsgi.py'.
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] Traceback (most recent call last):\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "C:/Users/Rasmus/workspace/MainSite/src/MainSite/wsgi.py", line 16, in <module>\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] application = get_wsgi_application()\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "c:\\anaconda3\\lib\\site-packages\\django\\core\\wsgi.py", line 13, in get_wsgi_application\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] django.setup()\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "c:\\anaconda3\\lib\\site-packages\\django\\__init__.py", line 17, in setup\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "c:\\anaconda3\\lib\\site-packages\\django\\conf\\__init__.py", line 55, in __getattr__\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] self._setup(name)\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "c:\\anaconda3\\lib\\site-packages\\django\\conf\\__init__.py", line 43, in _setup\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] self._wrapped = Settings(settings_module)\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "c:\\anaconda3\\lib\\site-packages\\django\\conf\\__init__.py", line 99, in __init__\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] mod = importlib.import_module(self.SETTINGS_MODULE)\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "c:\\anaconda3\\lib\\importlib\\__init__.py", line 126, in import_module\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] return _bootstrap._gcd_import(name[level:], package, level)\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 986, in _gcd_import\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 969, in _find_and_load\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed\r
[Fri Feb 24 18:44:49.946090 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 986, in _gcd_import\r
[Fri Feb 24 18:44:49.946090 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 969, in _find_and_load\r
[Fri Feb 24 18:44:49.946090 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked\r
[Fri Feb 24 18:44:49.946090 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] ImportError: No module named 'MainSite'\r
。私は周りを見回してみましたが、何も見つかりませんでした。しかし、私はそれが私のwsgi.pyファイルとは何かを持っていると思っています:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MainSite.settings")
application = get_wsgi_application()
これは単にデフォルトのwsgi.pyファイルです。私は構成がどのように見えるかについて何かを見つけることに成功していません。
私のプロジェクトで設定私は
DEBUG = True
ALLOWED_HOSTS = []
を持っており、アプリをインストールし
'mod_wsgi.server',
仕様:Apacheの/ 2.4.25(Win64の) - のmod_wsgi/4.5.14 - パイソン/ 3.5 - Windowsの10
私は誰かが正しい方向に私を導くことができると願っています。私が提供できる情報があれば教えてください。
のhttpd設定:
Listen 8080
LoadModule wsgi_module "c:/anaconda3/lib/site-packages/mod_wsgi/server/mod_wsgi.cp35-win_amd64.pyd"
WSGIPythonHome "c:/anaconda3"
WSGIScriptAlias/C:/Users/Rasmus/workspace/MainSite/src/MainSite/wsgi.py
WSGIPythonPath C:/Users/Rasmus/workspace/MainSite/src/MainSite
<Directory C:/Users/Rasmus/workspace/MainSite/src/MainSite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Windows上で行うように、手動でApacheを設定するときに、インストールされたアプリケーションに '' mod_wsgi.server''を追加する必要はありません。おそらく欠落しているのは、Pythonモジュールの検索パスをDjangoプロジェクトのある場所に設定することです。 mod_wsgiの設定を表示して、https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/modwsgi/を必ず読んでください。その中で述べたように '' WSGIPythonPath''を設定しましたか? –
@GrahamDumpleton WSGIPythonPathで更新しました – vandelay