问题: 在访问cobbler web界面到时候出现以下提示

Cobbler Web界面提示报错 “Internal Server Error”_web

解决步骤:

1. SSL 的报错日志如下:

[root@localhost ~]# tail -f /var/log/httpd/ssl_error_log
[Tue May 28 16:54:16.665181 2019] [:error] [pid 7001] [remote 192.168.1.109:44]   self._setup(name)
[Tue May 28 16:54:16.665190 2019] [:error] [pid 7001] [remote 192.168.1.109:44]   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup[Tue May 28 16:54:16.665205 2019] [:error] [pid 7001] [remote 192.168.1.109:44]     self._wrapped = Settings(settings_module)
[Tue May 28 16:54:16.665209 2019] [:error] [pid 7001] [remote 192.168.1.109:44]   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 110, in __init__[Tue May 28 16:54:16.665217 2019] [:error] [pid 7001] [remote 192.168.1.109:44]     mod = importlib.import_module(self.SETTINGS_MODULE)
[Tue May 28 16:54:16.665223 2019] [:error] [pid 7001] [remote 192.168.1.109:44]   File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module[Tue May 28 16:54:16.665445 2019] [:error] [pid 7001] [remote 192.168.1.109:44]     __import__(name)
[Tue May 28 16:54:16.665455 2019] [:error] [pid 7001] [remote 192.168.1.109:44]   File "/usr/share/cobbler/web/settings.py", line 89, in <module>
[Tue May 28 16:54:16.665500 2019] [:error] [pid 7001] [remote 192.168.1.109:44]   from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
[Tue May 28 16:54:16.665516 2019] [:error] [pid 7001] [remote 192.168.1.109:44]   ImportError: cannot import name TEMPLATE_CONTEXT_PROCESSORS

2. 查看cobbler的py配置文件

[root@localhost ~]# sed -n '38,41p' /usr/share/cobbler/web/settings.py
if django.VERSION[0] == 1 and django.VERSION[1] < 4:
    ADMIN_MEDIA_PREFIX = '/media/'
else:
    STATIC_URL = '/media/'
[root@localhost ~]# sed -n '89p' /usr/share/cobbler/web/settings.py
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS

3. 初步判断应该是pythone-django版本问题

##下载get-pip.py
[root@localhost ~]# wget http://bootstrap.pypa.io/get-pip.py

--2019-05-28 17:48:55--  http://bootstrap.pypa.io/get-pip.py
Resolving bootstrap.pypa.io (bootstrap.pypa.io)... 151.101.24.175, 2a04:4e42:2e::175
Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|151.101.24.175|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location:
https://bootstrap.pypa.io/get-pip.py [following]
--2019-05-28 17:48:56-- 
https://bootstrap.pypa.io/get-pip.py
Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|151.101.24.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1709825 (1.6M) [text/x-python]
Saving to: ‘get-pip.py’


100%[=======================================================================>] 1,709,825   99.6KB/s   in 24s   

2019-05-28 17:47:07 (69.8 KB/s) - ‘get-pip.py’ saved [1709825/1709825]



##调用本地python运行pip.py脚本
[root@localhost ~]# python get-pip.py
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after t
t date. A future version of pip will drop support for Python 2.7.Collecting pip
  Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-
y.whl (1.4MB)     |████████████████████████████████| 1.4MB 134kB/s
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-non
any.whlInstalling collected packages: pip, wheel
Successfully installed pip-19.1.1 wheel-0.33.4

##安装pip
[root@localhost ~]# pip install Django==1.8.9
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after t
t date. A future version of pip will drop support for Python 2.7.Collecting Django==1.8.9
  Downloading https://files.pythonhosted.org/packages/a7/a2/f4e7926062f5c61d98e87b9d0365ca1a0fab6be599dbea90ce2fab27f395/Django-1.8.9-py2.py3-non
any.whl (6.2MB)     |████████████████████████████████| 6.2MB 65kB/s
Installing collected packages: Django
  Found existing installation: Django 1.11.20
    Uninstalling Django-1.11.20:
      Successfully uninstalled Django-1.11.20
Successfully installed Django-1.8.9

##查看pip版本号
[root@localhost ~]# python -c "import django; print(django.get_version())"
1.8.9

4. 重启HTTP服务

[root@localhost ~]# systemctl restart httpd

5. 浏览器界面刷新即可

Cobbler Web界面提示报错 “Internal Server Error”_cobbler_02