Tuesday, May 15, 2012

Django REMOVE_SLASH

If you're coming from another CMS or Framework like me, then Django is probably messing up your weblinks too with the APPEND_SLASH option. (Since when is it more user friendly or beneficial to put a slash after every url? Most websites on the internet leave the end slash off, and Django seems to be going against common convention in this regard.)

You could leave APPEND_SLASH off, but this may lead to problems with SEO.

Anyway, I love Django in many other ways, and thankfully Django is flexible enough to allow us to fix this problem. I developed a middleware that basically does the opposite of APPEND_SLASH, and it's accordingly named Remove Slash Middleware.

It simply works like this:
1. Remove all slashes from the end of the requested url.
2. If the url location is not found, then add one slash '/' and try again.


Now you can choose to get rid of all those slashes at the ends of your urls. Delete, subtract, pop, erase those slashes.
https://gist.github.com/2204099
https://gist.github.com/gists/2204099/download


Comment or leave feedback sepero 111 @ gmx . com

3 comments:

  1. Exactly. A slash isn't an end, it's a beginning (e.g. /etc). This is recognized everywhere on the planet except in the Django world. Very odd. I always strip them.

    ReplyDelete
  2. GOOD Day !

    We have USA fresh & Verified SSN Leads with best connectivity score
    All info checked & genuine

    Info in LEADS
    First Name | Last Name | SSN | Dob | DL Number |Address | State | City | Zip | Phone Number | Account Number | Bank NAME

    *Price for SSN lead $2
    *You can ask for sample before any deal
    *If anyone buy in bulk, we can negotiate
    *Sampling is just for serious buyers

    ==>ACTIVE & FRESH CC FULLZ ALSO AVAILABLE<==
    ->$5 PER EACH

    ->Hope for the long term deal
    ->Interested buyers will be welcome

    **Contact Information**
    Whatsapp > +923172721122
    Email > leads.sellers1212@gmail.com
    Telegram > @leadsupplier
    ICQ > 752822040

    ReplyDelete
  3. Sepero Hacker: Django Remove_Slash >>>>> Download Now

    >>>>> Download Full

    Sepero Hacker: Django Remove_Slash >>>>> Download LINK

    >>>>> Download Now

    Sepero Hacker: Django Remove_Slash >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete