Installing the web interface#

The web interface, literature.ui, adds a catalogue of every stored reference, a page for each reference and each contributor, pages to add, edit, delete and import references, and a reference picker for your own forms. It is built on django-mvp and installed on top of the core, so install the core first.

The web interface needs Python 3.12 or later and Django 5.2 or later. A project on an older Python or Django keeps the core and cannot install the extra.

Steps#

  1. Install the ui extra:

    pip install "django-literature[ui]"
    
  2. Add the apps to INSTALLED_APPS, in this order, alongside literature:

    # settings.py
    INSTALLED_APPS = [
        # ...
        "literature",
        "django.contrib.sites",
        "django.contrib.staticfiles",
        "django_cotton",
        "easy_icons",
        "flex_menu",
        "django_tables2",
        "django_filters",
        "mvp",
        "daisy_cotton",
        "crispy_forms",
        "mvp_forms",
        "django_tomselect",
        "literature.ui",
    ]
    

    daisy_cotton comes directly after mvp, because both ship an icon component and the first app listed wins. django_tomselect comes after mvp_forms, so that django-mvp-forms’ template for its controls wins.

  3. Add the settings the page shell and the forms need:

    # settings.py
    STATIC_URL = "static/"
    SITE_ID = 1
    
    CRISPY_TEMPLATE_PACK = "daisyui"
    CRISPY_ALLOWED_TEMPLATE_PACKS = ["daisyui"]
    
    EASY_ICONS = {
        "default": {
            "renderer": "easy_icons.renderers.ProviderRenderer",
            "config": {"tag": "i"},
            "packs": ["mvp.utils.BS5_ICONS"],
        },
    }
    
    FLEX_MENUS = {
        "renderers": {
            "sidebar": "mvp.renderers.SidebarRenderer",
            "dock": "mvp.renderers.MobileFooterNavRenderer",
        },
    }
    
    TEMPLATES = [
        {
            # ...
            "OPTIONS": {
                "context_processors": [
                    # ...
                    "mvp.context_processors.mvp_config",
                ],
            },
        },
    ]
    
    MIDDLEWARE = [
        # ...
        "django.contrib.sites.middleware.CurrentSiteMiddleware",
        "django_tomselect.middleware.TomSelectMiddleware",
    ]
    

    Without the crispy-forms pack, the first form page raises an error. Without EASY_ICONS or FLEX_MENUS, every page does.

  4. Mount the URLs, and give the shell’s Home item somewhere to go:

    # urls.py
    from django.urls import include, path
    from django.views.generic import RedirectView
    
    urlpatterns = [
        # ...
        path("catalogue/", include("literature.ui.urls")),
        path("", RedirectView.as_view(pattern_name="literature:item-list"), name="home"),
    ]
    

    The routes are namespaced literature, so a template reverses them as {% url 'literature:item-list' %}. The shell’s mobile navigation links to a view named home on every page, so a project without one gets a warning on each render.

Open /catalogue/. The catalogue list, the reference pages and the contributor pages are live, with no view, template or styling left for you to write.

The page shell#

The web interface’s pages extend a template named base.html. django-mvp ships a default, so a project with none still gets a working shell. A base.html in your own template directory is found first and takes over.

Try the demo project#

The repository carries a runnable demo of everything above. From a fresh clone:

uv sync --extra ui
uv run python manage.py migrate
uv run python manage.py seed_demo
uv run python manage.py runserver

seed_demo loads a small catalogue of real references, and the site is served at http://127.0.0.1:8000/catalogue/. Browsing needs no account. To add, edit, remove or import references, sign in at http://127.0.0.1:8000/admin/login/ as editor.user with the password password. demo/seed/import-sample.bib is there to import.

seed_demo clears the catalogue before loading, so running it again returns the demo to the same state. The demo is not a production configuration: DEBUG is on and its secret key is committed.