[Openstack] Custom Dashboard Problem Openstack Mikata

Eric Sans Eric.Sans at extremenetworks.com
Thu Apr 20 16:22:38 UTC 2017


Hi

I'm trying to customize a dashboard using devstack and I have an issue to register my dashboard

I have followed the tutorial

https://docs.openstack.org/developer/horizon/tutorials/dashboard.html

So I left the file with default parameters after using this commands

mkdir openstack_dashboard/dashboards/mydashboard

python manage.db -- startdash mydashboard    --target openstack_dashboard/dashboards/mydashboard

mkdir openstack_dashboard/dashboards/mydashboard/mypanel

python manage.db  -- startpanel mypanel  --dashboard=openstack_dashboard.dashboards.mydashboard --target=openstack_dashboard/dashboards/mydashboard/mypanel

I did not modify any file , the idea first was to see my dashboard created.

And finaly  I enabled my dashboard by creating a file _50_mydashboard.py with this

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

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

# A list of applications to be added to INSTALLED_APPS.
ADD_INSTALLED_APPS = [
    'openstack_dashboard.dashboards.mydashboard',
]

I restart my virtual environment running on port 8000 and each time I tried to access to my dashboard I have this dump



System check identified no issues (0 silenced).
April 20, 2017 - 15:31:14
Django version 1.8.10, using settings 'openstack_dashboard.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
    return self.application(environ, start_response)
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 170, in __call__
    self.load_middleware()
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 52, in load_middleware
    mw_instance = mw_class()
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/middleware/locale.py", line 24, in __init__
    for url_pattern in get_resolver(None).url_patterns:
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 401, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 395, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/stack/horizon/openstack_dashboard/urls.py", line 36, in <module>
    url(r'', include(horizon.urls)),
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 34, in include
    patterns = getattr(urlconf_module, 'urlpatterns', urlconf_module)
 File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/utils/functional.py", line 225, in inner
    self._setup()
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/utils/functional.py", line 376, in _setup
    self._wrapped = self._setupfunc()
  File "/opt/stack/horizon/horizon/base.py", line 825, in url_patterns
    return self._urls()[0]
  File "/opt/stack/horizon/horizon/base.py", line 860, in _urls
    include(dash._decorated_urls)))
  File "/opt/stack/horizon/horizon/base.py", line 538, in _decorated_urls
    % self.default_panel)
NotRegistered: The default panel "" is not registered.
[20/Apr/2017 15:31:27] "GET / HTTP/1.1" 500 59
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
    return self.application(environ, start_response)
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 170, in __call__
    self.load_middleware()
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 52, in load_middleware
    mw_instance = mw_class()
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/middleware/locale.py", line 24, in __init__
    for url_pattern in get_resolver(None).url_patterns:
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 401, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 395, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/stack/horizon/openstack_dashboard/urls.py", line 36, in <module>
    url(r'', include(horizon.urls)),
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 34, in include
    patterns = getattr(urlconf_module, 'urlpatterns', urlconf_module)
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/utils/functional.py", line 225, in inner
    self._setup()
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/utils/functional.py", line 376, in _setup
    self._wrapped = self._setupfunc()
  File "/opt/stack/horizon/horizon/base.py", line 825, in url_patterns
    return self._urls()[0]
  File "/opt/stack/horizon/horizon/base.py", line 860, in _urls
    include(dash._decorated_urls)))
  File "/opt/stack/horizon/horizon/base.py", line 538, in _decorated_urls
    % self.default_panel)
NotRegistered: The default panel "" is not registered.
[20/Apr/2017 15:31:27] "GET / HTTP/1.1" 500 59

This is my dashboard.py

from django.utils.translation import ugettext_lazy as _

import horizon


class Mydashboard(horizon.Dashboard):
    name = _("Mydashboard")
    slug = "mydashboard"
    panels = ()  # Add your panels here.
    default_panel = ''  # Specify the slug of the dashboard's default panel.


horizon.register(Mydashboard)


This my panel.py

from django.utils.translation import ugettext_lazy as _

import horizon
from openstack_dashboard.dashboards.mydashboard import dashboard

class Mypanel(horizon.Panel):
    name = _("Mypanel")
    slug = "mypanel"


dashboard.Mydashboard.register(Mypanel)


any idea will be appreciated

Eric Sans
System Engineer / Extreme Networks
eric.sans at extremenetworks.com<mailto:eric.sans at extremenetworks.com>
Office  / +33 (0)141-922-246
Mobile / +33 (0)603848656

ExtremeNetworks.com
Connect Beyond the Network


________________________________

DISCLAIMER:
This e-mail and any attachments to it may contain confidential and proprietary material and is solely for the use of the intended recipient. Any review, use, disclosure, distribution or copying of this transmittal is prohibited except by or on behalf of the intended recipient. If you have received this transmittal in error, please notify the sender and destroy this e-mail and any attachments and all copies, whether electronic or printed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20170420/e55d3dba/attachment.html>


More information about the Openstack mailing list