Page MenuHomeSoftware Heritage

Update swh-web django applications configuration and setup
ClosedPublic

Authored by anlambert on Aug 19 2022, 2:42 PM.

Details

Summary

Towards reorganizing swh-web features into multiple django applications,
introduce the following changes regarding their settings:

  • Declare a fixed set of base django apps and enable to add extra ones through configuration
  • Add application templates directory to django templates search paths
  • Automatically register URLs of selected django applications
  • Inject swh-web django app names in templates to check a feature is enabled

Diffs that follow mainly move files around and perform renaming to isolate
swh-web features into dedicated django applications.

Related to T4398

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D8265 (id=29854)

Rebasing onto d72784ac65...

Current branch diff-target is up to date.
Changes applied before test
commit 0306c23d03783a1e5fdc898e76444dd2c534fbea
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Mon Jul 18 15:17:38 2022 +0200

    Update swh-web django applications configuration and setup
    
    Towards reorganizing swh-web features into multiple django applications,
    introduce the following changes regarding their settings:
    
    - Declare a fixed set of base django apps and enable to add extra ones
      through configuration
    
    - Add application templates directory to django templates search paths
    
    - Automatically register URLs of selected django applications
    
    - Inject swh-web django app names in templates to check a feature is enabled
    
    Related to T4398

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1980/ for more details.

vlorentz added inline comments.
swh/web/tests/conftest.py
1209–1217

how come you need that in tests?

swh/web/tests/conftest.py
1209–1217

That small hack is required for the new tests in following diffs to work correctly.

In those tests, I removed a django application from django settings by updating the SWH_DJANGO_APPS list
dynamically. As view URLs set depends on the declared applications, the django URL cache needs to be cleared
and repopulated to match the configuration. Then I can check that URLs of an application are not registered if
the application is not declared in settings.

swh/web/tests/conftest.py
1209–1217

ugh

This revision is now accepted and ready to land.Aug 19 2022, 5:19 PM