https://github.com/alirn76/shortener
URL Shortener
https://github.com/alirn76/shortener
django docker-image python url-shortener
Last synced: 8 months ago
JSON representation
URL Shortener
- Host: GitHub
- URL: https://github.com/alirn76/shortener
- Owner: AliRn76
- Created: 2022-12-07T16:09:49.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-02-07T15:37:22.000Z (over 1 year ago)
- Last Synced: 2025-02-07T16:31:53.075Z (over 1 year ago)
- Topics: django, docker-image, python, url-shortener
- Language: HTML
- Homepage: https://hub.docker.com/r/alirn76/url-shortener
- Size: 132 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# What is URL Shortener?
URL shortening is a technique on the World Wide Web in which a Uniform Resource Locator may be made substantially shorter and still direct to the required page.
This is achieved by using a redirect which links to the web page that has a long URL.
# How to use this image
## Simple usage:
`docker run --name shortener -d alirn76/url-shortener:latest`
## Options:
### Publish:
The instance starts at **port 8000**, so you can publish it in any port you want.
### WORKER:
**Default** is `2`
The instance starts with how many workers?
### BASE\_URL:
**Default** is [_http://127.0.0.1:8000_](http://127.0.0.1:8000)
**Usage:**
- 1. Show the _Shortened URL_ for copy
- 2. Check the _Original URL_ if `PRIVATE` is `true`
### PRIVATE:
**Default** is `false`
Check the `BASE_URL` in _Original URL_
> _It won't work correctly if `BASE_URL` is ip_
**example**:
`BASE_URL` = https://alirn.ir
- `Original URL` = https://google.com/something/ --> `Not Valid`
- `Original URL` = https://alirn.ir/something --> `OK`
- `Original URL` = http://alirn.ir/something --> `OK`
- `Original URL` = https://api.alirn.ir/something --> `OK`
- `Original URL` = https://alirn.ir.google.com/ --> `Not Valid`
### TITLE:
**Default** is `"URL Shortener"`
Used to show the **Title** of page _(you can put your website name in it)_
### DESCRIPTION:
**Default** is `"Create Short & Memorable URL In a Seconds."`
## Full-featured usage:
`docker run --name shortener --restart always -p 80:8000 -e WORKER=1 -e BASE_URL=https://example.com -e PRIVATE=true -e TITLE="URL Shortener" -e DESCRIPTION="Create Your Short URL Here" -d alirn76/url-shortener:latest`
## Persistent Storage:
> **Known Issue:** You'll get 5xx error if you don't create a docker volume.
- 1. Create docker volume → `docker volume create shortener-volume`
- 2. Add volume to you run command → `--volume shortener-volume:/shortener/database`
## Demo:

> ### Docker Image → [https://hub.docker.com/r/alirn76/url-shortener](https://hub.docker.com/r/alirn76/url-shortener)
> #### Thanks to [MohammadReza Shahbazi](https://www.linkedin.com/in/mohammadrezashahbazi/) for Frontend