35
Running ``run_tests.sh`` will build a virtualenv, ``.venv``, where all the
36
python dependencies for Horizon are installed and referenced. After the
37
dependencies are installed, the unit test suites in the Horizon repo will be
38
executed. There should be no errors from the tests.
33
40
Next you will need to setup your Django application config by copying ``openstack_dashboard/local/local_settings.py.example`` to ``openstack_dashboard/local/local_settings.py``. To do this quickly you can use the following command::
35
42
> cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py
39
46
To add new settings or customize existing settings, modify the ``local_settings.py`` file.
41
48
Horizon assumes a single end-point for OpenStack services which defaults to
42
the local host (127.0.0.1). If this is not the case change the
43
``OPENSTACK_HOST`` setting in the ``openstack_dashboard/local/local_settings.py`` file, to the actual IP address of the OpenStack end-point Horizon should use.
45
To start the Horizon development server use the Django ``manage.py`` utility
46
with the context of the virtual environment::
48
> tools/with_venv.sh ./manage.py runserver
50
Alternately specify the listen IP and port::
52
> tools/with_venv.sh ./manage.py runserver 0.0.0.0:8080
56
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::
58
> source .venv/bin/activate
61
Once the Horizon server is running point a web browser to http://localhost:8000
49
the local host (127.0.0.1), as is the default in DevStack. If this is not the
50
case change the ``OPENSTACK_HOST`` setting in the
51
``openstack_dashboard/local/local_settings.py`` file, to the actual IP address
52
of the OpenStack end-point Horizon should use.
54
To start the Horizon development server use ``run_tests.sh``::
56
> ./run_tests.sh --runserver localhost:9000
60
The default port for runserver is 8000 which is already consumed by
61
heat-api-cfn in DevStack. If not running in DevStack
62
`./run_tests.sh --runserver` will start the test server at
63
`http://localhost:8000`.
68
The ``run_tests.sh`` script provides wrappers around ``manage.py``.
69
For more information on manage.py which is a django, see
70
`https://docs.djangoproject.com/en/dev/ref/django-admin/`
73
Once the Horizon server is running, point a web browser to http://localhost:9000
62
74
or to the IP and port the server is listening for.
66
78
The ``DevStack`` project (http://devstack.org/) can be used to install
67
an OpenStack development environment from scratch.
79
an OpenStack development environment from scratch. For a local.conf that
80
enables most services that Horizon supports managing see
81
:doc:`local.conf <ref/local_conf>`
78
92
Optional support is provided for Swift.
95
Editing Horizon's Source
96
========================
98
Although DevStack installs and configures an instance of Horizon when running
99
stack.sh, the preferred development setup follows the instructions above on the
100
server/VM running DevStack. The are several advantages to maintaining a
101
separate copy of the Horizon repo, rather than editing the devstack installed
104
* Source code changes aren't as easily lost when running unstack.sh/stack.sh
105
* The development server picks up source code changes (other than JavaScript
106
and CSS due to compression and compilation) while still running.
107
* Log messages and print statements go directly to the console.
108
* Debugging with pdb becomes much simpler to interact with.
111
JavaScript and CSS changes require a development server restart. Also,
112
forcing a refresh of the page (e.g. using Shift-F5) in the browser is
113
required to pull down non-cached versions of the CSS and JavaScript. The
114
default setting in Horizon is to do compilation and compression of these
115
files at server startup. If you have configured your local copy to do
116
offline compression, more steps are required.
80
119
Horizon's Structure
81
120
===================