top of page
  • Youtube
  • X
  • TikTok
  • Facebook
  • Instagram
Search

Django CMS URL Issues: Trouble with Reversing

  • Writer: Mustafa Ramadan
    Mustafa Ramadan
  • Sep 15, 2023
  • 1 min read

I came across an unusual issue while using a custom AppHook with Django CMS. When I attached a custom app to a CMS page, there was a problem with generating the correct URLs in the template for that app, especially when using the `get_absolute_url` function.


To be more specific, the part of the URL that represents the page itself was missing:


<!-- The incorrect url being generated. -->
<a href="//bar/baz/">..</a> 
<!-- The url I should have been getting (where 'foo' is the name/url of my cms page)  -->
<a href="/foo/bar/baz/">...</a>

I sought help on Stack Overflow, and I found a solution. I had previously removed `cms.middleware.multilingual.MultilingualURLMiddleware` from my middleware settings but still had a `CMS_LANGUAGES` tuple in my configuration file. It seems that this combination was causing a problem with Django CMS. Once I removed the `CMS_LANGUAGES` settings, the URLs started generating correctly again.


So, the issue was resolved by adjusting my configuration settings to ensure they were in sync with each other.

 
 
 

Comments


Let’s Work Together

Need an experienced IT Professional to help out? Send me an email to discuss in more detail. Alternatively connect with me elsewhere on the web →

  • X
  • Instagram
  • Facebook
  • LinkedIn
  • YouTube
  • TikTok

Handcrafted by me © twentytwentythree. Powered and secured by Wix

bottom of page