OpenStack horizon開發環境搭建

來源:互聯網
上載者:User

此文檔是在本來安裝了計算節點的機器上實驗的。

 

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

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.