This application takes in an URL and shortens it. On following the shortened URL you will be redirected to the original webpage.
Note that each url gets mapped to a single shortened url, this is done to minimize collisions. The last "/" is not stripped from the url, and hence https://google.com and https://google.com/ will map to different shortened urls.
The application has been tested manually. In the interest of time, the unit tests have not been included as a part of this app. However, that is something high on the priority list.
- Language:
Python-3.11.0.
- Database:
SQLite
- ORM:
SQLAlchemy
- Serializer/Deserializer:
Marshmallow
- This has been set up, however it is not being used.
Working directory should be ./ (shorten_url)
Please ensure docker is installed and running. Also ensure that the docker-compose binary is in the path. To set up the app using docker. From within the project directory, please run:
docker-compose up
The containerized application should be available at:
Working directory should be ./ (shorten_url)
It is suggested you create a virtual environment if you wish to run the application locally. To do this please follow the given steps
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
This will ideally be handled using migration, however for a single object model this script works well.
python3 bin/db_setup.py
python3 main.py
The application should now be available at: