↓のサイトを参考にさくらのvps(centos)でdjangoを公開しようとしています。
http://typea.info/blg/glob/2016/05/django-centos7.html
pyenv-virtualenvでpython3.5.0の環境をつくりました。
ブラウザからアクセスすると Internal Server Error
になり、
less /var/log/httpd/error_log
は下記のとおりです。
解決方法を教えていただけませんでしょうか?
[Sun Jun 05 22:42:14 2016] [error] [client 106.161.170.146] mod_wsgi (pid=10772): Target WSGI script '/home/user/django/mysite/mysite/wsgi.py' cannot be loaded as Python module. [Sun Jun 05 22:42:14 2016] [error] [client 106.161.170.146] mod_wsgi (pid=10772): Exception occurred processing WSGI script '/home/user/django/mysite/mysite/wsgi.py'. [Sun Jun 05 22:42:14 2016] [error] [client 106.161.170.146] Traceback (most recent call last): [Sun Jun 05 22:42:14 2016] [error] [client 106.161.170.146] File ""/home/user/django/mysite/mysite/wsgi.py"", line 12, in <module> [Sun Jun 05 22:42:14 2016] [error] [client 106.161.170.146] from django.core.wsgi import get_wsgi_application [Sun Jun 05 22:42:14 2016] [error] [client 106.161.170.146] File ""/home/user/.pyenv/versions/3.5.0/envs/django/lib/python3.5/site-packages/django/__init__.py"", line 1, in <module> [Sun Jun 05 22:42:14 2016] [error] [client 106.161.170.146] from django.utils.version import get_version [Sun Jun 05 22:42:14 2016] [error] [client 106.161.170.146] File ""/home/user/.pyenv/versions/3.5.0/envs/django/lib/python3.5/site-packages/django/utils/version.py"", line 7, in <module> [Sun Jun 05 22:42:14 2016] [error] [client 106.161.170.146] from django.utils.lru_cache import lru_cache [Sun Jun 05 22:42:14 2016] [error] [client 106.161.170.146] File ""/home/user/.pyenv/versions/3.5.0/envs/django/lib/python3.5/site-packages/django/utils/lru_cache.py"", line 28 [Sun Jun 05 22:42:14 2016] [error] [client 106.161.170.146] fasttypes = {int, str, frozenset, type(None)}, [Sun Jun 05 22:42:14 2016] [error] [client 106.161.170.146] ^ [Sun Jun 05 22:42:14 2016] [error] [client 106.161.170.146] SyntaxError: invalid syntax
/etc/httpd/conf.d/django.conf
と、
/etc/httpd/conf.d/userdir.conf
は、それぞれ下記のように記述しています。
/etc/httpd/conf.d/django.conf
WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py WSGIPythonPath /path/to/mysite.com WSGIPythonPath /home/user/.pyenv/versions/3.5.0/envs/django/lib/python3.5/site-packages <Directory /path/to/mysite.com/mysite> <Files wsgi.py> Require all granted </Files> </Directory>
/etc/httpd/conf.d/userdir.conf
<IfModule mod_userdir.c> # # UserDir is disabled by default since it can confirm the presence # of a username on the system (depending on home directory # permissions). # UserDir enable # # To enable requests to /~user/ to serve the user's public_html # directory, remove the "UserDir disabled" line above, and uncomment # the following line instead: # #UserDir public_html </IfModule>
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/06/11 05:22