This project is an Instagram clone built with Django. The application has a UI similar to Instagram's web version.
A running version of this app already deployed on Heroku. Click here to use it.
The following installations instruction are for Ubuntu.
To run this application, you will need Python, Git and Postgresql on your system.
sudo apt install python3 git postgresql
Once that is done, clone this repository onto you computer and enter the new directory.
git clone https://github.com/VictorKMaina/instagram
cd instagram/
The app requires some dependencies to run. To install them, first create a virtual environment and activate it.
python3 -m venv env
source env/bin/activate
Then install the dependencies using pip.
pip install -r requirements.txt
Since the app also needs a database to run, we need to set up Postgres.Postgres will need you to create a username and password to access databases. You can follow the steps here to get started.
Once you have a Postgres username, enter Postgres using psql
on your terminal and create a new database.
psql
CREATE DATABASE instagram;
Now that you have a database create, you need to create some environment variables so that Django can use. In the project's root directory, create a .env
file. Add the following to it, updating it with your own information.
SECRET_KEY='<Your Secret Key>'
DEBUG=True
DB_NAME='instagram'
DB_USER='<Your Postgres Username>'
DB_PASSWORD='<Your Postgres Password>'
DB_HOST='127.0.0.1'
MODE='dev'
ALLOWED_HOSTS=['*']
DISABLE_COLLECTSTATIC=1
During the login process, the app sends a confirmation email to a new user. For this to work, it needs to be intergrated with Sendgrid. Here are the steps to generating an API key from Sendgrid's documentation.
Sign up for a SendGrid account
Create and store a SendGrid API key with full access "Mail Send" permissions.
Verify your Sender Identity
On step 3, use the quick verification method to verify one email address. Remember this address.
Once you have generated your API key, add it to the environment variables.
SENDGRID_API_KEY='<Your Sendgrid API Key>'
In the project directory, navigate to /app/email.py
. Edit the from email property and insert your verified email address.
def send_activation_email(request, user, email_address):
message = Mail(
from_email="<Verified Email Address>",
...
Now that the .env
file is ready to use, we need to upgrade our database to correspond with the app's models.
python manage.py migrate
The app is now ready to run.
python managy.py runserver