=======================
Using the web interface
=======================

The web interface is built using the Django_  web
framework, and requires that Django be installed (see :doc:`installation`).

For a single project
--------------------

Before using the web interface, you must have created a Sumatra project using
``smt init``.

To launch the web interface, in your project directory run::

    $ smtweb &
    
This will launch a simple web server that listens on port 8000, and will
automatically open a new tab in your browser at http://127.0.0.1:8000/.

If port 8000 is already in use, you can specify a different port with the ``-p``
option to ``smtweb``, e.g.::

    $ smtweb -p 8001


For multiple projects
---------------------

If you are using a single record store for multiple projects, you can start
``smtweb`` with the path to your record store database file, e.g.::

    $ smtweb ~/sumatra.db
    
You can also use the ``-p`` option here.

Finishing up
------------

Don't forget to kill the webserver process (e.g. with ``fg``, ``Ctrl-C``) when you are
finished with it.


Customizing the web interface
-----------------------------

You can customize the web interface on a per-project basis by placing your own
`Django templates`_ in a "templates" subdirectory of the Sumatra ".smt" directory.
The templates you can customize are called "base.html", "record_list.html",
"show_file.html", "project_detail.html", "show_csv.html", "show_image.html",
"record_detail.html", "show_diff.html", "tag_list.html". The best way to proceed
is to copy the default template from "/path/to/sumatra/web/templates"
to "/path/to/myproject/.smt/templates" and then modify it.

.. _Django: http://www.djangoproject.com/
.. _`Django templates`: http://docs.djangoproject.com/en/1.2/topics/templates/