Skip to content

Latest commit

 

History

History
113 lines (75 loc) · 3.04 KB

README.md

File metadata and controls

113 lines (75 loc) · 3.04 KB

image-jinn

High-performance image storage service

example workflow example workflow Code style: black

This system is build over s3 storage which is scalable and reliable.

Clone

git clone https://github.com/vkmrishad/image-jinn.git
or
git clone [email protected]:vkmrishad/image-jinn.git

System dependencies

Environment and Package Management

Install Poetry

$ pip install poetry
or
$ pip3 install poetry

Activate or Create Env

$ poetry shell

Install Packages from Poetry

$ poetry install

NB: When using virtualenv, install from requirements.txt using $ pip install -r requirements.txt. For environment variables follow sample.env

Runserver

$ python manage.py runserver
or
$ ./manage.py runserver

Run Celery

$ celery -A image_jinn  worker -l info

Runserver using docker

Check this documentation to run with docker, refer link Create .env file in project folder and copy all ENV vars without having export.

For initial db setup add, postgres ENV vars

POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres

You can use your own values, Please use DATABASE_HOST='postgres' for docker settings only

$ docker-compose build
$ docker-compose up

For shutting down use,

$ docker-compose down

Apply migration to database

$ docker-compose exec app python manage.py migrate

Collect static command for swagger

$ docker-compose exec app python manage.py collectstatic

Testing

$ docker-compose exec app moto_server &
$ docker-compose exec app python manage.py test apps

Access server: http://127.0.0.1:8000

API Endpoints

Run collect static to update swagger templates

$ python manage.py collectstatic
or
$ ./manage.py collectstatic

Check Swagger/Redoc documantation after running server

Test

For testing, moto_server need to be run in a new tab or background. For running moto_server, Flask is required and added in requirements.txt.

$ moto_server

moto_server will be running on http://127.0.0.1:5000, then run test

$ python manage.py test apps
or
$ ./manage.py test apps

Create superuser

Create superuser to test admin feature

$ python manage.py createsuperuser
or
$ ./manage.py createsuperuser