alan-turing-institute / data-classification-app

Classification webapp for the Turing Data Safe Haven
MIT License
4 stars 0 forks source link

Ensure the development team understand the current `django` structure #358

Open DavidBeavan opened 3 years ago

ChristinaLast commented 3 years ago
ChristinaLast commented 3 years ago

django in data-classification-app

web app and django app

Structure of the haven django webapp

haven/
    __init__.py    # tells django this is a python project
    urls.py        # has access to settings of urls used
    wsgi.py        # used to deploy the webserver
    settings/*     # configuration for app

Structure of a projects django app

projects/
    admin.py      # allows user to add feature to the admin page
    __init__.py   # tells file its a python package
    apps.py       # used to configure apps
    models.py     # database layout
    views.py      # used to display database layout

This structure is reflected in the haven/identity/* app and the haven/data/* app.

Migrations

django's way of propagating changes you make to your models

URLs

urls.py in the webapphaven/ directory contains links to the urls within eachdjango app, e.g haven/urls.py.

urlpatterns = [
    path('users/', include('haven.identity.urls', namespace='identity')),

    path('projects/', include('haven.projects.urls', namespace='projects')),
]

views.py

url provides a mapping* to a view (for example in haven/projects/urls.py)

Project list class available in the list urlpattern.

forms.py

DavidBeavan commented 2 years ago

Move content above to wiki, then close. More issues can be opened on the specifics

DavidBeavan commented 2 years ago

@ChristinaLast to kindly park the content in a wiki, then do close