Dùng thư viện pyshorteners (API TinyURL) để chuyển URL dài thành URL ngắn.
Triển khai
pip install pyshortenersView dựa trên class
Viewvới GET/POST:POST: lấy URL từ request, gọi
pyshorteners.Shortener().tinyurl.short(long_url), render lại template vớishort_url.Template: form nhập URL, hiển thị kết quả rút gọn.
Kết quả
Nhập link dài → bấm "Shorten URL" → hiện link ngắn có thể copy.