【问题标题】:TypeError at /project/ coercing to Unicode: need string or buffer, NoneType found/project/ 处的 TypeError 强制转换为 Unicode:需要字符串或缓冲区,找到 NoneType
【发布时间】:2019-04-02 19:15:20
【问题描述】:

我使用本指南 OSA 全新安装了 OpenStack Ansible。运行剧本后,安装成功完成,没有任何失败的剧本/任务。使用 Ubuntu 16.04 Server 部署服务器。

但是,当我转到 OpenStack 仪表板并登录时,我收到此错误 pastebin

追溯:

环境: 请求方法:GET 请求网址:https://10.100.1.111/project/ Django 版本:1.11.14 Python版本:2.7.12 已安装的应用程序: ['openstack_dashboard.dashboards.project', 'heat_dashboard', 'openstack_dashboard.dashboards.admin', 'openstack_dashboard.dashboards.identity', 'openstack_dashboard.dashboards.settings', 'openstack_dashboard', 'django.contrib.contenttypes', 'django.contrib.auth', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django_pyscss', 'openstack_dashboard.django_pyscss_fix', '压缩机', '地平线', 'openstack_auth'] 已安装的中间件: ('django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'horizo​​n.middleware.OperationLogMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'horizo​​n.middleware.Horizo​​nMiddleware', 'horizo​​n.themes.ThemeMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'openstack_dashboard.contrib.developer.profiler.middleware.ProfilerClientMiddleware', 'openstack_dashboard.contrib.developer.profiler.middleware.ProfilerMiddleware') 模板错误: 在模板 /openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/horizo​​n/templates/horizo​​n/common/_sidebar.html 中,第 4 行出现错误 强制转换为 Unicode:需要字符串或缓冲区,发现 NoneType 1:{% load branding horizo​​n i18n %} 2: 3: 4 : {% 水平导航 %} 5: 6: 追溯: 内部文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/core/handlers/exception.py” 41.响应=get_response(请求) _get_response 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/core/handlers/base.py” 217. 响应 = self.process_exception_by_middleware(e,请求) _get_response 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/core/handlers/base.py” 215. 响应 = response.render() 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/response.py” 107. self.content = self.rendered_content render_content 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/response.py” 84. 内容 = 模板.render(上下文,self._request) 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/backends/django.py” 66. return self.template.render(context) 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 207. return self._render(context) _render 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 199. return self.nodelist.render(context) 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 990.bit = node.render_annotated(上下文) render_annotated 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 957. return self.render(context) 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/loader_tags.py” 177. 返回已编译的_parent._render(上下文) _render 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 199. return self.nodelist.render(context) 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 990.bit = node.render_annotated(上下文) render_annotated 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 957. return self.render(context) 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/loader_tags.py” 72. 结果 = block.nodelist.render(上下文) 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 990.bit = node.render_annotated(上下文) render_annotated 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 957. return self.render(context) 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/loader_tags.py” 72. 结果 = block.nodelist.render(上下文) 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 990.bit = node.render_annotated(上下文) render_annotated 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 957. return self.render(context) 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/loader_tags.py” 216.返回模板.render(上下文) 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 209. return self._render(context) _render 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 199. return self.nodelist.render(context) 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 990.bit = node.render_annotated(上下文) render_annotated 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py” 957. return self.render(context) 渲染中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/django/template/library.py” 225. _dict = self.func(*resolved_args, **resolved_kwargs) Horizo​​n_nav 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/horizo​​n/templatetags/horizo​​n.py” 74. panel.can_access(context)): can_access 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/horizo​​n/base.py” 149.返回self.allowed(上下文) 允许的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/horizo​​n/base.py” 158. return self._can_access(context['request']) _can_access 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/horizo​​n/base.py” 170. if policy_check(rule_param, request): 检查文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/openstack_auth/policy.py” 148. 执行者 = _get_enforcer() _get_enforcer 中的文件“/openstack/venvs/horizo​​n-19.0.0.0b1/lib/python2.7/site-packages/openstack_auth/policy.py” 57. 如果 os.path.isfile(enforcer.policy_path): isfile 中的文件“/usr/lib/python2.7/genericpath.py” 37. st = os.stat(路径) 异常类型:/project/ 处的 TypeError 异常值:强制转换为 Unicode:需要字符串或缓冲区,找到无类型

我不明白这个错误。当我使用 OS 客户端时,OpenStack API 工作正常。唯一的问题是,由于这个问题,我无法使用 OpenStack 仪表板。

请帮忙。提前致谢。

【问题讨论】:

    标签: ansible openstack dashboard openstack-horizon horizon


    【解决方案1】:

    我也遇到过这个问题。我希望我的经验可以对遇到此问题的其他人有所帮助。就我而言,我刚刚从仪表板设置中的策略过滤器中删除了“编排”。 您可以尝试在设置文件(/etc/openstack-dashboard/local_settings.py)中注释掉这一行:

    '编排':'/usr/local/lib/python2.7/dist-packages/heat_dashboard/conf/heat_policy.json',

    例如在 /etc/openstack-dashboard/local_settings.py 中

    来自:

         POLICY_FILES = {
             'orchestration': '/usr/local/lib/python2.7/dist-packages/heat_dashboard/conf/heat_policy.json',
             'identity': 'keystone_policy.json',
             'compute': 'nova_policy.json',
             'volume': 'cinder_policy.json',
             'image': 'glance_policy.json',
             'network': 'neutron_policy.json'
    }
    

    到:

    POLICY_FILES = {
    #    'orchestration': '/usr/local/lib/python2.7/dist-packages/heat_dashboard/conf/heat_policy.json',
        'identity': 'keystone_policy.json',
        'compute': 'nova_policy.json',
        'volume': 'cinder_policy.json',
        'image': 'glance_policy.json',
        'network': 'neutron_policy.json'
    }
    

    【讨论】:

      猜你喜欢
      • 2014-12-21
      • 1970-01-01
      • 1970-01-01
      • 2012-06-06
      • 1970-01-01
      • 2021-03-28
      • 2015-02-01
      • 1970-01-01
      相关资源
      最近更新 更多