- Created our project!
- Created submodule shortner which is our main app!
- Add a templates directory and configured the setting.py in urlshortner app
- Created our template index.html
- Created a route to a link that points to our "shortner.urls"
- Created a views and used the template html page as our response
- Add routing for the model in shortener.urls.py
- Created a simple fronte-end and a form, POST form
- Created a script to redirect the response data to /create routes
- Add shortened url redirection
- Add url parser in shortner/views
- Query to avoid multiple url with diffrent shortened url
- I'm saving URL/Link as URL in the database!!
- we are going to use gunicorn and django-heroku
- using uuid4 and taking first 5 character from the uuid4 is bad, randomness < 16 ^ 5!
- using random.choice() on (26 + 26 + 10) alphabet + number is bad too, randomness < 62 ^ 5 as we are not randomizing the static main character string>.
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
abcdefghixyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890jklmnopqrstuvw
bcdefghixyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890jklmnopqrstuvwa...
- final, using python's secrets library
import secrets
random_string = secrets.token_urlsafe(5)