Basic user interface for lizard websites
Lizard-ui is opinionated: it makes choices and prescribes (good!) technologies.
Our own license is GPLv3.
Here’s an excerpt of a settings.py you can use. The media and static root directory setup assumes the use of buildout, but you can translate it to your own filesystem setup:
And a suitable apache config hint:
Lizard-ui 3.0 requires Django 1.3 as we want to start using class based views and some of the other 1.3 goodies. For that, you need to make some changes.
Add LOGGING, for instance with:
from lizard_ui.settingshelper import setup_logging LOGGING = setup_logging(BUILDOUT_DIR) # For production, use for instance: # LOGGING = setup_logging(BUILDOUT_DIR, console_level=None)
And remove any by-hand logging setup, for instance with logging.basicConfig().
Import STATICFILES_FINDERS from lizard_ui, this adds a finder that also finds static media in /media in addition to the new /static:
from lizard_ui.settingshelper import STATICFILES_FINDERS
COMPRESS_STORAGE, COMPRESS_URL and COMPRESS_ROOT can now be removed from your settings as the defaults are now fine.
Switch from using bin/django build_static to bin/django collectstatic.
You can mount lizard-ui’s urls, but it contains only live examples. So perhaps you should only mount it in debug mode under /ui. Handy, as it contains reasonably full documentation on how to use it, including available blocks and classes/IDs that you can use.
The base layout is defined in realbase.html. You should however extend lizard_ui/lizardbase.html and then override the blocks that you want.
A example of a common task: change the logo. For that, make a static/lizard_ui directory in your django application (or site) and place a logo.png in it. Django-staticfiles’ mechanism will take your logo.png in preference to lizard-ui’s.
The first time, you’ll have to run the “bootstrap” script to set up setuptools and buildout:
$> python bootstrap.py
And then run buildout to set everything up:
(On windows it is called bin\buildout.exe).
You’ll have to re-run buildout when you or someone else made a change in setup.py or buildout.cfg.
The current package is installed as a “development package”, so changes in .py files are automatically available (just like with python setup.py develop).
If you want to use trunk checkouts of other packages (instead of released versions), add them as an “svn external” in the local_checkouts/ directory and add them to the develop = list in buildout.cfg.
Tests can always be run with bin/test or bin\test.exe.
Starting with version 4.21 a language selector has been added to lizard-ui. To activate the language selector for your project, put these changes in your settings file:
Make sure USE_I18N = True is set.
Add UI_SHOW_LANGUAGE_PICKER = True.
Add 'django.middleware.locale.LocaleMiddleware' to MIDDLEWARE_CLASSES just below the SessionMiddleware line and above the CommonMiddleware line.
Put the available languages in the LANGUAGES settings, e.g.:
LANGUAGES = ( ('en', 'English'), ('nl', 'Nederlands'), ('vi', 'Việt'), )
Pick a default language, e.g. LANGUAGE_CODE = 'en'