https://github.com/hur/urlshort
URL shortening web app built using Flask
https://github.com/hur/urlshort
flask python url-shortener
Last synced: about 1 month ago
JSON representation
URL shortening web app built using Flask
- Host: GitHub
- URL: https://github.com/hur/urlshort
- Owner: hur
- Created: 2019-10-24T18:31:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T09:52:01.000Z (over 3 years ago)
- Last Synced: 2025-10-26T16:39:21.298Z (7 months ago)
- Topics: flask, python, url-shortener
- Language: Python
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# URLshort

Shortens URLs by taking translating database indexes to a radix-56 representation with a character set that improves readability.
For a live demo, see https://hur.wtf (for proper TLS, please use https://url-shortening-app.herokuapp.com/).
The demo runs on a free heroku dyno, which means that the dyno sleeps when not used and takes some time to restart.
## How to setup development environment
### Requirements
Python 3 & virtualenv (recommended)
### Steps
Clone the repository and cd into the directory:
```
git clone https://github.com/hur/urlshort.git
cd urlshort
```
Set up a virtual environment:
`virtualenv venv`
Activate the virtual environment:
```
(Windows / CMD):
venv\Scripts\activate
(Mac OS / Unix):
source venv/bin/activate
```
Install requirements:
`pip install -r requirements.txt`
Set up `.env` file with your secret key
```
SECRET_KEY = "yoursecretkey"
```
You can generate a random secret key using Python:
```
>>> import uuid
>>> uuid.uuid4().hex
```
Configure your environment variables and `config.py` to suit your needs, e.g.
if you wish to use a different database url.
It is recommended to set the `URL` environment variable to whatever url you are running the app in
(e.g. `http://127.0.0.1:5000`)
so that the app can provide correct output.
To initialize the database, use
```
flask createdb
```
Run the app using `flask run`. In some cases using `python -m flask run` instead may resolve issues that occur with `flask run`.
For running all tests, use `py.test`