URL shortener application built with Django and PostgreSQL.
Follow steps to install locally.
-
Prerequisites Python 3.8+ PostgreSQL Git
-
Clone Repository
git clone <repo-url>
cd url_shortener_project
- Setup Database
sudo -iu postgres psql
CREATE USER your_db_user WITH PASSWORD 'password123';
CREATE DATABASE shortener_db OWNER your_db_user;
\q
- Configure Environment Variables
cp .env.example .envopen the .env file and set the following variables:
SECRET_KEY='generate-a-strong-random-key-here' DEBUG=True DATABASE_URL='postgres://your_db_user:your_password@localhost:5432/shortener_db'
- Setup Virtual Environment
python -m venv venv
source venv/bin/activate- Install Dependencies
pip install -r requirements.txt- Run Database Migrations
python manage.py migrate- Create Superuser (Optional) For django admin panel
python manage.py createsuperuser- Run Development Server
python manage.py runserverVisit http://127.0.0.1:8000/.