###問題点
DjangoでWEBページを制作しています。
ApacheとDjangoをmod_wsgiで繋ごうとしているのですが、
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log.
と表示され、上手く行きません。どうすればよいかご教授願います。
###環境
- python3.5(※python2もインストールされているが、virtualenvにてpython3をデフォルトに設定)
- virtualenv 15.2.0 環境名:nextone
- Django 2.0.4 プロジェクトフォルダ:
/opt/webapp/nextone
- Apache 2.4.18
- mod_wsgi 4.6.4
###Apacheのerror.logの内容
mod_wsgi (pid=16342): Failed to exec Python script file '/opt/webapp/nextone/wsgi.py'. mod_wsgi (pid=16342): Exception occurred processing WSGI script '/opt/webapp/nextone/wsgi.py'. Traceback (most recent call last): File "/opt/webapp/nextone/wsgi.py", line 16, in <module> application = get_wsgi_application() File "/home/kei/.virtualenvs/nextone/lib/python3.5/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application django.setup(set_prefix=False) File "/home/kei/.virtualenvs/nextone/lib/python3.5/site-packages/django/__init__.py", line 19, in setup configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) File "/home/kei/.virtualenvs/nextone/lib/python3.5/site-packages/django/conf/__init__.py", line 56, in __getattr__ self._setup(name) File "/home/kei/.virtualenvs/nextone/lib/python3.5/site-packages/django/conf/__init__.py", line 43, in _setup self._wrapped = Settings(settings_module) File "/home/kei/.virtualenvs/nextone/lib/python3.5/site-packages/django/conf/__init__.py", line 106, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/home/kei/.virtualenvs/nextone/lib/python3.5/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked ImportError: No module named 'nextone'
###/etc/apache2/apache2.conf
LoadModule wsgi_module "/usr/lib/apache2/modules/mod_wsgi-py35.cpython-35m-arm-linux-gnueabihf.so" WSGIPythonHome "/home/kei/.virtualenvs/nextone"
###/etc/apache2/sites-available/django.conf
<VirtualHost *:80> WSGIDaemonProcess nextone python-home=/home/kei/.virtualenvs/nextone python-path=/home/kei/.virtualenvs/nextone/bin/python3.5/site-packages WSGIScriptAlias / /opt/webapp/nextone/wsgi.py process-group=nextone <Directory /opt/webapp/nextone> <Files wsgi.py> Require all granted </Files> </Directory> </VirtualHost>
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。