目标 WSGI 脚本 '/usr/share/openstack-dashboard/openstack_dashboard/wsgi.py' 不能作为 Python 模块加载

问题描述

我正在使用 Ubuntu pro 18.04 LTS 部署 openstack Stein。

我在控制器节点上部署了 Horizo​​n 服务,以便使用此 article 控制所有 Openstack 组件

但是当请求 apache2 http 服务器时。我处理此错误消息:

 public class Personviewmodel
 {       

     public Personviewmodel(){

          People=new CustomObservableCollection<Person>();

     }
    
     private void AddPerson(){

        People.Add(new Person(){
            FirstName="John",LastName="Doe",Age=20
        });

      }
    
      private void UpdatePerson(){

         var person=People.Where(...).FirstOrDefault();
         person.Age=25;

         People.Refresh(person);
      }

      public CustomObservableCollection<Person> People { get; set; } 
    
    }

打开apache2日志文件时:

500 Internal Server Error

我发现以下内容

cat /var/log/apache2/error.log

对于 wsgi.py 文件,这是内容

[Sun May 09 13:13:38.406476 2021] [mpm_event:notice] [pid 20423:tid 140376496065472] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Sun May 09 13:13:38.407099 2021] [core:notice] [pid 20423:tid 140376496065472] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 09 13:13:43.003464 2021] [mpm_event:notice] [pid 20423:tid 140376496065472] AH00493: SIGUSR1 received.  Doing graceful restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name,using 10.0.0.4. Set the 'ServerName' directive globally to suppress this message
[Sun May 09 13:13:43.011960 2021] [mpm_event:notice] [pid 20423:tid 140376496065472] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Sun May 09 13:13:43.011977 2021] [core:notice] [pid 20423:tid 140376496065472] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 09 13:17:46.415685 2021] [mpm_event:notice] [pid 20423:tid 140376496065472] AH00491: caught SIGTERM,shutting down
[Sun May 09 13:17:46.468567 2021] [mpm_event:notice] [pid 21198:tid 139990706088896] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Sun May 09 13:17:46.468646 2021] [core:notice] [pid 21198:tid 139990706088896] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 09 13:21:29.390499 2021] [mpm_event:notice] [pid 21198:tid 139990706088896] AH00491: caught SIGTERM,shutting down
[Sun May 09 13:21:49.634226 2021] [mpm_event:notice] [pid 1255:tid 140256812567488] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Sun May 09 13:21:49.659254 2021] [core:notice] [pid 1255:tid 140256812567488] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 09 13:23:59.045495 2021] [mpm_event:notice] [pid 1255:tid 140256812567488] AH00493: SIGUSR1 received.  Doing graceful restart
[Sun May 09 13:23:59.426244 2021] [mpm_event:notice] [pid 1255:tid 140256812567488] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Sun May 09 13:23:59.426259 2021] [core:notice] [pid 1255:tid 140256812567488] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 09 13:24:13.239708 2021] [mpm_event:notice] [pid 1255:tid 140256812567488] AH00493: SIGUSR1 received.  Doing graceful restart
[Sun May 09 13:24:13.246379 2021] [mpm_event:notice] [pid 1255:tid 140256812567488] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Sun May 09 13:24:13.246398 2021] [core:notice] [pid 1255:tid 140256812567488] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 09 13:27:25.458793 2021] [mpm_event:notice] [pid 1255:tid 140256812567488] AH00491: caught SIGTERM,shutting down
[Sun May 09 13:27:25.517766 2021] [mpm_event:notice] [pid 2855:tid 140136656354240] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Sun May 09 13:27:25.517896 2021] [core:notice] [pid 2855:tid 140136656354240] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 09 13:43:29.758680 2021] [mpm_event:notice] [pid 2855:tid 140136656354240] AH00493: SIGUSR1 received.  Doing graceful restart
[Sun May 09 13:43:31.269009 2021] [mpm_event:notice] [pid 2855:tid 140136656354240] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Sun May 09 13:43:31.269046 2021] [core:notice] [pid 2855:tid 140136656354240] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 09 13:46:08.093465 2021] [mpm_event:notice] [pid 2855:tid 140136656354240] AH00491: caught SIGTERM,shutting down
[Sun May 09 13:46:08.158907 2021] [mpm_event:notice] [pid 4869:tid 139664207449024] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Sun May 09 13:46:08.159030 2021] [core:notice] [pid 4869:tid 139664207449024] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 09 14:52:45.196411 2021] [mpm_event:notice] [pid 4869:tid 139664207449024] AH00493: SIGUSR1 received.  Doing graceful restart
[Sun May 09 14:52:48.224709 2021] [mpm_event:notice] [pid 4869:tid 139664207449024] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Sun May 09 14:52:48.224752 2021] [core:notice] [pid 4869:tid 139664207449024] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 09 15:06:37.695556 2021] [mpm_event:notice] [pid 4869:tid 139664207449024] AH00493: SIGUSR1 received.  Doing graceful restart
[Sun May 09 15:06:39.207131 2021] [mpm_event:notice] [pid 4869:tid 139664207449024] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Sun May 09 15:06:39.207172 2021] [core:notice] [pid 4869:tid 139664207449024] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 09 15:10:05.835601 2021] [mpm_event:notice] [pid 4869:tid 139664207449024] AH00491: caught SIGTERM,shutting down
[Sun May 09 15:10:42.512223 2021] [mpm_event:notice] [pid 1371:tid 140201303968704] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Sun May 09 15:10:42.785301 2021] [core:notice] [pid 1371:tid 140201303968704] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 09 15:20:22.791837 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268] mod_wsgi (pid=1379): Target Wsgi script '/usr/share/openstack-dashboard/openstack_dashboard/wsgi.py' cannot be loaded as Python module.
[Sun May 09 15:20:22.791908 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268] mod_wsgi (pid=1379): Exception occurred processing Wsgi script '/usr/share/openstack-dashboard/openstack_dashboard/wsgi.py'.
[Sun May 09 15:20:22.793946 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268] Traceback (most recent call last):
[Sun May 09 15:20:22.793991 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268]   File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi.py",line 29,in <module>
[Sun May 09 15:20:22.793998 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268]     application = get_wsgi_application()
[Sun May 09 15:20:22.794004 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268]   File "/usr/lib/python3/dist-packages/django/core/wsgi.py",line 13,in get_wsgi_application
[Sun May 09 15:20:22.794007 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268]     django.setup(set_prefix=False)
[Sun May 09 15:20:22.794013 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268]   File "/usr/lib/python3/dist-packages/django/__init__.py",line 22,in setup
[Sun May 09 15:20:22.794017 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268]     configure_logging(settings.LOGGING_CONfig,settings.LOGGING)
[Sun May 09 15:20:22.794022 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268]   File "/usr/lib/python3/dist-packages/django/conf/__init__.py",line 56,in __getattr__
[Sun May 09 15:20:22.794026 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268]     self._setup(name)
[Sun May 09 15:20:22.794031 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268]   File "/usr/lib/python3/dist-packages/django/conf/__init__.py",line 41,in _setup
[Sun May 09 15:20:22.794034 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268]     self._wrapped = Settings(settings_module)
[Sun May 09 15:20:22.794040 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268]   File "/usr/lib/python3/dist-packages/django/conf/__init__.py",line 137,in __init__
[Sun May 09 15:20:22.794044 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268]     raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)
[Sun May 09 15:20:22.794062 2021] [wsgi:error] [pid 1379:tid 140201173231360] [remote XXX.XXX.XXX.XXX:44268] ValueError: Incorrect timezone setting: UTC+01:00
[Sun May 09 15:21:39.911979 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061] mod_wsgi (pid=1378): Target Wsgi script '/usr/share/openstack-dashboard/openstack_dashboard/wsgi.py' cannot be loaded as Python module.
[Sun May 09 15:21:39.912056 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061] mod_wsgi (pid=1378): Exception occurred processing Wsgi script '/usr/share/openstack-dashboard/openstack_dashboard/wsgi.py'.
[Sun May 09 15:21:39.912508 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061] Traceback (most recent call last):
[Sun May 09 15:21:39.912563 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061]   File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi.py",in <module>
[Sun May 09 15:21:39.912568 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061]     application = get_wsgi_application()
[Sun May 09 15:21:39.912574 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061]   File "/usr/lib/python3/dist-packages/django/core/wsgi.py",in get_wsgi_application
[Sun May 09 15:21:39.912577 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061]     django.setup(set_prefix=False)
[Sun May 09 15:21:39.912582 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061]   File "/usr/lib/python3/dist-packages/django/__init__.py",in setup
[Sun May 09 15:21:39.912585 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061]     configure_logging(settings.LOGGING_CONfig,settings.LOGGING)
[Sun May 09 15:21:39.912590 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061]   File "/usr/lib/python3/dist-packages/django/conf/__init__.py",in __getattr__
[Sun May 09 15:21:39.912593 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061]     self._setup(name)
[Sun May 09 15:21:39.912598 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061]   File "/usr/lib/python3/dist-packages/django/conf/__init__.py",in _setup
[Sun May 09 15:21:39.912601 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061]     self._wrapped = Settings(settings_module)
[Sun May 09 15:21:39.912626 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061]   File "/usr/lib/python3/dist-packages/django/conf/__init__.py",in __init__
[Sun May 09 15:21:39.912629 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061]     raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)
[Sun May 09 15:21:39.912645 2021] [wsgi:error] [pid 1378:tid 140201190016768] [remote XXX.XXX.XXX.XXX:40061] ValueError: Incorrect timezone setting: UTC+01:00

什么是修复?

解决方法

最后,它起作用了。我不得不将时区设置更改为字符串...请参阅 article(大陆/城市)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...