此文档是在本来安装了计算节点的机器上实验的。
cd /home/github
1.取得源代码:
git clone https://github.com/openstack/horizon.git
备份一份
mkdir /home/src
pwd
/home
cp -r /github/horizon /src
cd /home/src/horizon
2.install the prerequisite packages:
apt-get install nodejs
3. create a virtual environment:
python tools/install_venv.py 时间很长
注意,1.运行前先修改一下tools/install_venv.py,在def create_virtualenv函数里,指定安装pip的版本为1.1,
if not run_command([WITH_VENV, 'easy_install', 'pip==1.1']).strip():
2.安装virtual environment时经常出现timeout错误,因此可以修改tools/install_venv.py文件中的def pip_install函数,增加default-timeout参数,run_command(['tools/with_venv.sh', 'pip','--default-timeout=1800', 'install', '--upgrade'] + list(args),redirect_output=False) 。
另外,尽量运行python tools/install_venv.py安装虚拟环境,如果失败,下次安装会接着失败处继续安装
安装成功会提示:
Horizon development environment setup is complete.
To activate the virtualenv for the extent of your current shell session you
can run:
$ source .venv/bin/activate
官方文档:
Note
If you would like to run commands without the prefix of tools/with_venv.sh you may source your environment directly. This will remain active as long as your shell session stays open:
> source .venv/bin/activate
例如使用:
> tools/with_venv.sh ./manage.py runserver
Alternately specify the listen IP and port:
> tools/with_venv.sh ./manage.py runserver 0.0.0.0:8080
如果加入
source .venv/bin/activate
就可以直接输入命令了
python manage.py runserver 0.0.0.0:8080
注意:0.0.0.0需要修改为ip地址
4. unit tests:
./run_tests.sh 时间很长
最后提示:
Horizon development environment setup is complete.
To activate the virtualenv for the extent of your current shell session you
can run:
$ source .venv/bin/activate
Running Horizon application tests
nosetests --verbosity 1 horizon --nocapture --nologcapture --exclude-dir=horizon/conf/ --cover-package=horizon --cover-inclusive --all-modules
Creating test database for alias 'default'...
...........................................................S
----------------------------------------------------------------------
Ran 60 tests in 64.473s
OK (SKIP=1)
Destroying test database for alias 'default'...
Running openstack_dashboard tests
nosetests --verbosity 1 openstack_dashboard --nocapture --nologcapture --cover-package=openstack_dashboard --cover-inclusive --all-modules
Failed to load keyring modules.
WARNING:root:No local_settings file found.
Creating test database for alias 'default'...
..........................................................................................................................................................................................................................................................................................................................................................SS..S
----------------------------------------------------------------------
Ran 351 tests in 149.702s
OK (SKIP=3)
Destroying test database for alias 'default'...
Tests completed successfully.
5. cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py
6.运行
python manage.py runserver 192.168.240.101:8080
输入用户名admin 密码openstack 提示认证失败 An error occurred authenticating. Please try again later.
在运行runserver 服务后,在服务器的后台就运行了一个服务。
在本地就可以通过浏览器中输入192.168.1.125:8080
用户名admin
密码openstack登录
浏览器一定要使用支持html5的浏览器,推荐使用最新firefox和chrome ,IE9兼容性还是很不好。
参考文档:
http://docs.openstack.org/developer/nova/devref/development.environment.html
http://docs.openstack.org/developer/horizon/quickstart.html
http://blog.163.com/ghj_114/blog/static/6823525620129261317875/
http://docs.openstack.org/developer/nova/devref/development.environment.html
tools/with_venv.sh <your command>
http://docs.openstack.org/developer/nova/devref/development.environment.html
) s5 `2 X- e# W5 x/ l8 s
http://docs.openstack.org/developer/nova/devref/unit_tests.html! y" O
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。