Giter Site home page Giter Site logo

itsarreguin / instagram Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3.08 MB

Instagram clone built with Django

License: MIT License

Shell 0.39% Dockerfile 0.69% Python 50.32% HTML 31.64% JavaScript 4.97% SCSS 11.99%
celery django django-channels python redis server-sent-events websockets

instagram's Introduction

Instagram Clone

This project is an Instagram clone designed and built by my own using Django, HTMX and a little bit of JS, it has basic characteristics like, posting images, likes, comments, account management and some advanced features like, real-time notifications throught Server-Sent Events and a messaging system implemented using WebSockets. Follow the next steps to star using this app.

Readme cover Readme cover

Requirements

This is a list of the recommended tools to run Instagram clone on your machine.

  • Python
  • PostgreSQL
  • Docker

Environment

If you want to use this project, first you'll need to configure an environment to run it. Make a directory and, after, clone the code inside the new dir.

Docker

Docker and docker compose are the easiest way to start using this application, only you need to start docker engine and run the following command.

docker compose -f compose.dev.yml up --build

Also you can run services separated in different terminal windows.

docker compose -f compose.dev.yml up <service_name>

Cretate a superuser for start using the app fastly

docker compose -f compose.dev.yml exec -it django bash

The previous command gives you access to a bash terminal, if you run ls command, you will see all files including the manage.py file and the project dir.

Now Run:

python manage.py createsuperuser

PIP and Virtaulenv

Follow the next steps to start the project using a virtaulenv and pip.

Virtaul environment

Make and activate a virtual env.

python -m venv <venv_name>
# If you are using Mac or Linux
source <venv_name>/bin/activate

# If you are a Windows user
.\<venv_name>\Scripts\activate

Install required dependendices

pip install -r requirements/dev.txt

# Or use the requirements.txt file that is just for development

Redis instance using docker

This project uses Channels for WebSockets and Celery for background tasks, you need to run a Redis instance to be used as a data transport and broker.

docker run --rm -it -p 6379:6379 redis

Note: Previous command deletes Redis instance when you press Ctrl + C to shutdown the server.

Run Django commands

python manage.py migrate
python manage.py createsuperuser
python manage.py runserver

Celery

Now, we need to run our Celery app for processing background tasks.

The next command runs the Celery app inside the project (instagram.__init__.celery) and starts the worker using a Thread Pool with 2 threads and the log level in debug mode.

celery -A instagram worker -P threads -c 2 -l DEBUG

In instagram.settings.dev you can find a constant named CELERY_TASK_ALWAYS_EAGER that runs tasks synchronously, change to False if you want a real background execution.

instagram's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.