User Tools

Site Tools


slowcontrol:web_interface

Web Interface Development

How to add a new app

  • create a new directory inside prima-web-interface/src
  • create the following subdirectories
    • templates to store template html and js files, i.e. using jinja instructions
    • static to store fixed html, js or css files
  • create the following files
    • urls.py containing the list of URL patterns for the app
    • views.py containing the functions to be executed on GET on POST requests
  • update src/prima_site/settings.py', adding the name of the new directory where needed
  • add an include in src/main/urls.py
  • update the appropriate template file in src/main/templates/ to set the proper URL on the proper link. The URL has to be one of those defined in urls.py
Using Static files

Static files are e.g. html, js or css files which are included in the html code. To include them correctly use a tag like

    {% static '<filename>' %}

where <filename> contains no path.

Using Models

Models are container classes which can be used to store data in the DB.

  • define the model classes in models.py in the app directory
  • add the model class names in src/main/admin.py
Introductory Slides
slowcontrol/web_interface.txt · Last modified: 2022/08/11 11:52 by himuser

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki