Fix sitemap generation for static pages
authorMagnus Hagander <magnus@hagander.net>
Mon, 26 Oct 2020 20:53:31 +0000 (21:53 +0100)
committerMagnus Hagander <magnus@hagander.net>
Wed, 28 Oct 2020 15:39:27 +0000 (16:39 +0100)
In commit 7f8a0a56dd1fb5dedb5c04a872ce940ae7c891b4 we replaced the way
the "core" app is loaded, and this broke the generation of sitemap
entries for it. Oops.

pgweb/util/sitestruct.py

index fb959ed7262d346326f51ef544a2b742332ef96a..9a04b6b976befef44ed42bd16c2f54e8ccd4a1d1 100644 (file)
@@ -14,6 +14,9 @@ def get_all_pages_struct(method='get_struct'):
     for app in settings.INSTALLED_APPS:
         if app.startswith('pgweb.'):
             try:
+                if '.apps.' in app:
+                    # If the app has a specific appconfig, we still go directly for struct,so remove it
+                    app = app[:app.index('.apps.')]
                 m = __import__(app + ".struct", {}, {}, method)
             except Exception as e:
                 # Failed to import - probably module didnd't exist