Coder Social home page Coder Social logo

instagram-api's Introduction

Instagram API

Simple Instagram API clone built on Django.


Start up the project

The next steps are assistance to start using the instagram API clone.


Clone project repo

Clone the project using one of the next commands (using https or ssh).

git clone https://github.com/itsarreguin/instagram-api.git
git clone [email protected]:itsarreguin/instagram-api.git

Create a virtualenv

To create the Python virtual environment we will use the default python venv module.

python -m venv <virtualenv_name>

Virtualenv activation and deactivation

Activation on MacOS and Linux.

python source <virtualenv_name>/bin/activate

Activation on Windows using Powershell

python .\<vitualenv_name>\Scripts\activate

Deactivation

To defuse your virtualenv only use the next command, this works on the three operating systems.

deactivate

Installing dependencies

The project has the requirements folder and requirements.txt file, this last is just an extension of dev.txt file inside the requirements folder.

pip install -r requirements.txt

Run migrations

Before to start using the project run database migrations using the following command.

python manage.py migrate

Running the API

Once the dependencies are installed you can start running the API

python manage.py runserver

If the Django's default port is occupied on your computer change this in the same command

python manage.py runserver <port>

python manage.py runserver 8080

Create your superuser

If you wanna create an admin superuser run the next command and fill in all fields

python manage.py createsuperuser

After that, run the server again and visit admin site localhost:8000/admin/

Celery and RabbitMQ

The Instagram API project uses Celery and RabbitMQ to run background tasks, execute in new shell's the next commands

Running Celery

celery -A instagram.tasks:celery worker --loglevel=info -P threads

Add the broker url in your .env file

CELERY_BROKER_URL=amqp://localhost:5672

Running RabbitMQ

In my case, I use Docker to run a RabbitMQ instance using the following command

docker run --rm -it -p 5672:5672 rabbitmq

The previous command runs the latest version of RabbitMQ in Docker, when press Ctrl + C the container to be removed.

Using Redis for Celery

If you wanna use Redis to run tasks follow the next steps

  • Run a Redis docker container or install redis on your computer

    docker run --rm -it -p 6379:6379 redis
  • Add redis url in your .env file

    CELERY_BROKER_URL=redis://localhost:6379
    
  • Repeat the command to run Celery once again

Note: Redis client has already been included in this project

Dependencies links

  1. Django:

  2. Django REST Framework

  3. Celery:

  4. PyJWT

Credits

Made with <3 and code by <@itsarreguin>

Instagram is a Meta, Inc. trademark.

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.