Simple Instagram API clone built on Django.
The next steps are assistance to start using the instagram API clone.
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
To create the Python virtual environment we will use the default python venv module.
python -m venv <virtualenv_name>
Activation on MacOS and Linux.
python source <virtualenv_name>/bin/activate
Activation on Windows using Powershell
python .\<vitualenv_name>\Scripts\activate
To defuse your virtualenv only use the next command, this works on the three operating systems.
deactivate
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
Before to start using the project run database migrations using the following command.
python manage.py migrate
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
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/
The Instagram API project uses Celery and RabbitMQ to run background tasks, execute in new shell's the next commands
celery -A instagram.tasks:celery worker --loglevel=info -P threads
Add the broker url in your .env file
CELERY_BROKER_URL=amqp://localhost:5672
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.
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
-
Django:
- Documentation: djangoproject.com
- Repository: github.com/django/django/
-
Django REST Framework
- Documentation: django-rest-framework.org
- Repository: github.com/encode/django-rest-framework
-
Celery:
- Documentation: docs.celeryq.dev
- Repository: github.com/celery/celery
-
PyJWT
- Repository: github.com/jpadilla/pyjwt
Made with <3 and code by <@itsarreguin>
Instagram is a Meta, Inc. trademark.