[Python] How to create short urls without having database [duplicate]

Discussão em 'Python' iniciado por Stack, Junho 12, 2025.

  1. Stack

    Stack Membro Participativo


    Its a college django project.. where I can't really setup a database model to store dynamically generated URLs and redirect to short urls based on hashed primary key.. etc

    I am thinking in lines of encrypting URL using some algorithm and decrypt on the server. Initially, I thought of using md5 hash but I guess we can't decrypt.

    My actual URL would look like:

    http://mydomain.com/photo?friend_name=dennis&me_name=ritchie&ping_url=http%3A%2F%2Fmydomain.com%2Fimg%3Furl%3Dhttps%3A%fsjcsd.googleueusercontent.com%2F-Sf6bP2nOKa8%2FUMaw8vv0QLI%2FAaaddjhnkchkjda7E%2Fs800%2FHosbsco.png%26message%3Dhi+dude


    I am thinking it to convert into:

    http://mydomain.com?encode=hksfhsfksuhkvbkjnukvns


    Then on server side I thinking to convert hksfhsfksuhkvbkjnukvns back to actual string.

    Is there any Python Lib I have

    Continue reading...

Compartilhe esta Página