标签:
关于Horizon的设计理念:
来自官网(http://docs.openstack.org/developer/horizon/intro.html):
Horizon holds several key values at the core of its design and architecture:
Core Support: Out-of-the-box support for all core OpenStack projects.
Extensible: Anyone can add a new component as a “first-class citizen”.
Manageable: The core codebase should be simple and easy-to-navigate.
Consistent: Visual and interaction paradigms are maintained throughout.
Stable: A reliable API with an emphasis on backwards-compatibility.
Usable: Providing an awesome interface that people want to use.
The only way to attain and uphold those ideals is to make it easy for developers to implement those values.
官网中特别强调了一句话:
At its core, Horizon should be a registration pattern for applications to hook into
Horizon要像积木一样,(除了Core以外的)应用是可拔插的。灵活,看上去也Cool。
来看下Horizon的结构:
This project is a bit different from other OpenStack projects in that it has two very distinct components underneath it: horizon, and openstack_dashboard.
The horizon directory holds the generic libraries and components that can be used in any Django project.
The openstack_dashboard directory contains a reference Django project that uses horizon.
Horizon的设计基于Django框架,遵循DRY原则。
首先我们先看看 horizon/ 这个目录。horizon这个目录包括了具体应用可能需要用到的公共组件,如table,form等等。
另外一个重要的目录就是 openstack_dashboard/ 这个目录,具体的应用视图是定义在这个目录下的,比如networks的dashboard目录就是 openstack_dashboard/project/networks/ ,每个具体应用的目录结构跟django的app结构相似:
project/
|---__init__.py
|---dashboard.py <-----Registers the app with Horizon and sets dashboard properties
|---overview/
|---images/
|-- images
|-- __init__.py
|---panel.py <-----Registers the panel in the app and defines panel properties
|-- snapshots/
|-- templates/
|-- tests.py
|-- urls.py
|-- views.py
...
...
其他细节,等需要用到在详细介绍。
标签:
原文地址:http://www.cnblogs.com/mcflurry/p/4624986.html