Skip to content

mitian233/py-url-shortener

Repository files navigation

py-url-shortener

日本語

You can deploy it on any PaaS provider like Heroku, Vercel, etc.

Get started

Self-host

Clone this repository and install the dependencies.

git clone https://github.com/mitian233/py-url-shortener.git
cd py-url-shortener
pip install -r requirements.txt

This project uses MongoDB Atlas as the database, so you need to create a MongoDB Atlas account and a database cluster.

Copy the .env.example file to .env and fill in the environment variables.

cp .env.example .env

The .env file should look like this:

MONGO_URL = mongodb+srv://<username>:<password>@<cluster-url>/<database>?retryWrites=true&w=majority
MONGO_DB = Cluster0
MONGO_COLLECTION = ShortenedURLs
URL_LENGTH = 5
SITE_URL = https://s.mikan.ac.cn

Then run the following command to start the server.

gunicorn -b 0.0.0.0:5000 index:app

Set up your reverse proxy like Nginx to forward requests to the server.

✨Your site is on live now!

Vercel

Click the button below to deploy it on Vercel.

Deploy with Vercel

Following the introduction of the environment variables descriped above and edit the Environment Variables in the Vercel dashboard.

image.png

⚠️Once you change the environment variables, you need to redeploy your project!

Live demo: https://py-url-shortener.vercel.app/

About

🔗URL shortener written with Python. 🚀Now support API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published