I finally set up embedded mode of wsgi like this link with help.
I was ready to move on authenticating with mod wsgi and apache in Django. In this django manual, it explains simply and kindly how to do that. I followed instructions but it showed internal server error after pop up for checking ID and password. No matter I entered authenticated user info in pop up windows or not, it showed internal server error on screen, not Django page.
My setting
/etc/apache2/mods-available/wsgi.conf
<IfModule mod_wsgi.c>
WSGIPythonHome /usr/local/pythonenv
WSGIPythonPath /home/cango/jaemyun
</IfModule>
/etc/apache2/mods-available/wsgi.load
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi-py35.cpython-35m-x835m-x86_64-linux-gnu.so
/etc/apache2/sites-available
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
WSGIScriptAlias / /home/cango/jaemyun/jaemyun/wsgi.py
WSGIProcessGroup %{GLOBAL}
WSGIApplicationGroup %{GLOBAL}
<Location "/">
AuthType Basic
AuthName "Top Secret"
Require valid-user
AuthBasicProvider wsgi
WSGIAuthUserScript /home/cango/jaemyun/jaemyun/wsgi.py
</Location>
<Directory /home/cango/jaemyun/jaemyun>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
home/cango/jaemyun/jaemyun/wsgi.py
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'jaemyun.settings'
from django.contrib.auth.handlers.modwsgi import check_password
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()
1.Embedded mod of wsgi worked before changing codes following the manual.
2.My Apache instance is running only one Django application.
3.mod_auth_basic and mod_authz_user are load.
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
mime_module (shared)
mpm_event_module (shared)
negotiation_module (shared)
setenvif_module (shared)
status_module (shared)
wsgi_module (shared)
4.error.log : Tatget WSGI script '/home/cango/jaemyun/jaemyun/wsgi.py' cannot be loaded as Python module.
[Mon Nov 21 09:54:19.934158 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] mod_wsgi (pid=9066): Target WSGI script '/home/cango/jaemyun/jaemyun/wsgi.py' cannot be loaded as Python module.
[Mon Nov 21 09:54:19.934229 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] mod_wsgi (pid=9066): Exception occurred processing WSGI script '/home/cango/jaemyun/jaemyun/wsgi.py'.
[Mon Nov 21 09:54:19.934483 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] Traceback (most recent call last):
[Mon Nov 21 09:54:19.934559 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "/home/cango/jaemyun/jaemyun/wsgi.py", line 16, in <module>
[Mon Nov 21 09:54:19.934565 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] application = WSGIHandler()
[Mon Nov 21 09:54:19.934573 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "/usr/local/pythonenv/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 153, in __init__
[Mon Nov 21 09:54:19.934578 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] self.load_middleware()
[Mon Nov 21 09:54:19.934585 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "/usr/local/pythonenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 80, in load_middleware
[Mon Nov 21 09:54:19.934590 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] middleware = import_string(middleware_path)
[Mon Nov 21 09:54:19.934598 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "/usr/local/pythonenv/lib/python3.5/site-packages/django/utils/module_loading.py", line 20, in import_string
[Mon Nov 21 09:54:19.934602 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] module = import_module(module_path)
[Mon Nov 21 09:54:19.934609 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "/usr/local/pythonenv/lib/python3.5/importlib/__init__.py", line 126, in import_module
[Mon Nov 21 09:54:19.934614 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] return _bootstrap._gcd_import(name[level:], package, level)
[Mon Nov 21 09:54:19.934632 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "<frozen importlib._bootstrap>", line 986, in _gcd_import
[Mon Nov 21 09:54:19.934640 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "<frozen importlib._bootstrap>", line 969, in _find_and_load
[Mon Nov 21 09:54:19.934648 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
[Mon Nov 21 09:54:19.934655 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
[Mon Nov 21 09:54:19.934662 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "<frozen importlib._bootstrap_external>", line 665, in exec_module
[Mon Nov 21 09:54:19.934669 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
[Mon Nov 21 09:54:19.934677 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "/usr/local/pythonenv/lib/python3.5/site-packages/django/contrib/auth/middleware.py", line 4, in <module>
[Mon Nov 21 09:54:19.934681 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] from django.contrib.auth.backends import RemoteUserBackend
[Mon Nov 21 09:54:19.934688 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "/usr/local/pythonenv/lib/python3.5/site-packages/django/contrib/auth/backends.py", line 4, in <module>
[Mon Nov 21 09:54:19.934692 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] from django.contrib.auth.models import Permission
[Mon Nov 21 09:54:19.934699 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "/usr/local/pythonenv/lib/python3.5/site-packages/django/contrib/auth/models.py", line 4, in <module>
[Mon Nov 21 09:54:19.934703 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
[Mon Nov 21 09:54:19.934710 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "/usr/local/pythonenv/lib/python3.5/site-packages/django/contrib/auth/base_user.py", line 52, in <module>
[Mon Nov 21 09:54:19.934715 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] class AbstractBaseUser(models.Model):
[Mon Nov 21 09:54:19.934721 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "/usr/local/pythonenv/lib/python3.5/site-packages/django/db/models/base.py", line 105, in __new__
[Mon Nov 21 09:54:19.934726 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] app_config = apps.get_containing_app_config(module)
[Mon Nov 21 09:54:19.934733 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "/usr/local/pythonenv/lib/python3.5/site-packages/django/apps/registry.py", line 237, in get_containing_app_config
[Mon Nov 21 09:54:19.934737 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] self.check_apps_ready()
[Mon Nov 21 09:54:19.934744 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] File "/usr/local/pythonenv/lib/python3.5/site-packages/django/apps/registry.py", line 124, in check_apps_ready
[Mon Nov 21 09:54:19.934748 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] raise AppRegistryNotReady("Apps aren't loaded yet.")
[Mon Nov 21 09:54:19.934769 2016] [wsgi:error] [pid 9066:tid 140549692573440] [client 222.101.237.134:64647] django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
I can't understand what I set wrongly. I followed instructions in manual and read all relating documents in manual.