This application is built to shorten the URL's like bitly, goo.gl. It's simple, intuitive and efficient. It's built using Flask.
Hope you like it :)
- Generates the short url randomly without any conflicts
- Uses NoSQL DynamoDB for easier storage and retrieval
- Doesn't generate a short url if it exists already
- Visualizes the URL hits in the form of pie chart
- Contains a statisics page for all short urls generated and individual URL's too
- Python3
- Flask
- Jinja2
- Bootstrap 4
- Google Charts
- MomentJS
- redis "Workaround for increment counter"
- Coverage
- AWS DynamoDB
- Python3 with pip installed.
- Any OS
Install the Virtualenv module
$ pip install virtualenv
Change the Directory to App
$ cd flask-app
Initialize the virtual environment in project directory and install the dependencies
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ export TABLE_NAME = <enter the dynamodb table name>
$ export SECRET_KEY = <enter your secret key>
$ export AWS_DEFAULT_REGION = <enter your AWS region>
$ export IP = <enter the public ip address of the server>
The following command is to run the development server
$ python run.py
To run flask in production we need to configure an application server. Here we are using gunicorn.
More details on configuring gunicorn can be found here
To start gunicorn, run the following command
$ gunicorn --bind 0.0.0.0:5000 wsgi:app
I have created an nginx reverse proxy and attached an ssl certificate to it to make it production ready system. You can find the systemd file 'cut-it.service' and an environment file 'cut-it.env'
To run the unit tests
cd flask-app/url_shortener/tests
Now run the unit test
coverage run -m unittest discover
To generate a report we need the run the below command
coverage report -m --omit="**/test*"
To generate a html report for better representation we need to run
coverage html --omit="**/test"
- Hiteshwara Sharma - (https://github.com/hiteshsp)