Ask Your Question
0

TemplateDoesNotExist error when adding a new dashboard

asked 2016-11-04 02:53:40 -0600

chansonzhang gravatar image

Hello, When I add an dashboard into /usr/share/openstack-dashboard/openstack_dashboard/dashboards add I create configure files in /usr/share/openstack-dashboard/openstack_dashboard/local/enabled The details are appended in the end. But When I restart the httpd.service and memcached.service, and try to open the dashboard in browser, It gave an "TemplateDoesNotExist" error.

TemplateDoesNotExist at /monitor/
monitor/info/index.html
……
Template-loader postmortem

Django tried loading these templates, in this order:
Using loader horizon.themes.ThemeTemplateLoader:
/usr/share/openstack-dashboard/openstack_dashboard/themes/default/templates/monitor/info/index.html (File does not exist)
Using loader django.template.loaders.filesystem.Loader:
/usr/share/openstack-dashboard/openstack_dashboard/templates/monitor/info/index.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
/usr/share/openstack-dashboard/openstack_dashboard/templates/monitor/info/index.html (File does not exist)
/usr/lib/python2.7/site-packages/django/contrib/auth/templates/monitor/info/index.html (File does not exist)
/usr/lib/python2.7/site-packages/compressor/templates/monitor/info/index.html (File does not exist)
/usr/lib/python2.7/site-packages/horizon/templates/monitor/info/index.html (File does not exist)
Using loader horizon.loaders.TemplateLoader:

_5000_monitor_settings.py

 # The name of the dashboard to be added to HORIZON['dashboards']. Required.
DASHBOARD = 'monitor'

# If set to True, this dashboard will not be added to the settings.
DISABLED = False


ADD_INSTALLED_APPS = [
    'openstack_dashboard.dashboards.monitor',
]

ADD_ANGULAR_MODULES = [
    'horizon.dashboard.monitor',
]

AUTO_DISCOVER_STATIC_FILES = True

_5140_monitor_info_panel.py

 PANEL = 'monitor_info_panel'
  PANEL_DASHBOARD = 'monitor'
  PANEL_GROUP = 'monitor'
  ADD_PANEL = 'openstack_dashboard.dashboards.monitor.info.panel.Info'
  DEFAULT_PANEL = 'monitor_info_panel'

dashboard.py

#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from django.utils.translation import ugettext_lazy as _

from openstack_auth import utils

import horizon

from django.conf import settings


class Monitor(horizon.Dashboard):
    name = _("Monitor")
    slug = "monitor"
    if getattr(settings, 'POLICY_CHECK_FUNCTION', None):
        policy_rules = (('monitor_info_panel', 'admin_required'),)
    else:
        permissions = (tuple(utils.get_admin_permissions()),)
horizon.register(Monitor)

panel.py

from django.utils.translation import ugettext_lazy as _

import horizon


class Info(horizon.Panel):
    name = _("Monitoring Information")
    slug = 'monitor_info_panel'
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2016-11-06 01:23:15 -0600

chansonzhang gravatar image

I may have some thing wrong in my newly added panel, but I can't find out. So I try to copy an entire panel directory from exist admin dashboard, and make some modifications correspondingly. Then all things get ok.

I still wonder what's the real cause of this problem. And if anyone can give me some document about how horizon.loaders.TemplateLoader work, I will appreciate it very much!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2016-11-04 02:53:40 -0600

Seen: 331 times

Last updated: Nov 06 '16