URL shortener using Django and Delpoying on Heroku.
live on : sirishurl
To set up we need to install certain libraries .
virtualenv installation.
$ pip install virtualenv
creating a virtual environment folder.
$ virtualenv python_virtual_env
$ cd python_virtual_env
activate the virtual environment.
$ source bin/activate
(python_virtual_env)$
we are done setting up virtual environment !
Now let us install Django in the virtual environment
Django installation is very simple
(python_virtual_env)$pip install django
we need to create a project to work on.
(python_virtual_env)$ django-admin.py startproject Simple
(python_virtual_env)$ cd Simple
we have to create a superuser who is similar to an admin.
(python_virtual_env)$ python manage.py createsuperuser
It will prompts certain requirements like username , email , passwords ..
We have finish setting up our first Djando server.
(python_virtual_env)$ python manage.py runserver
great🤟 :)
progress █████▒▒▒▒▒ 50 %
Now to create an app we have to run
(python_virtual_env)$ python manage.py startapp simplify
it can be any name.
Automatically should create a shortcode of each url
push it into the sqlite3(initially)
When the link already in the database same shortcode will be given.
progress ████████▒▒ 80 %
Awesome !
Requirements
(python_virtual_env)$pip install heroku
(python_virtual_env)$pip install django-heroku
(python_virtual_env)$pip install psycopg2
(python_virtual_env)$pip install whitenoise
(python_virtual_env)$pip install gunicorn
Create a Procfile and a requirements.txt and configuration
How to do it
Djando app while deploying on heroku there may be errors due to static files
Configuration of static files
Static files
Since heroku provides postgresql so we have to configure postgresql
Full Configuration
Finally on , Heroku Server where our app is running we have to run
$python manage.py migrate
CodeForEntrepreneurs they are awesome