Giter VIP home page Giter VIP logo

image_api's Introduction

Image API

Simple REST API built in Python with Django and DRF.

Gives ability to upload images, that later can be downloaded as:

  • original files
  • resized thumbnails
  • can be converted to binary images (black/white) and served as binary data for specified time

Possibilities are depending on users tier, there are some built-in tiers. Admins can also create new tiers and specify ability to download binary/original files or choose custom thumbnail sizes.

I decided to make API available only for logged-in users and make uploaded photos available only for their owners (used X-SendFile for that). Structure of media links is also hidden behind randomly generated UUIDs. Thumbnails are generated on the upload (for performance - nginx could manage file serving).

Used containers:

  • python (running API with gunicorn)
  • nginx (proxy server, serving images and static files)
  • postgres (DB)
  • redis (caching - I decided to use caching with TTL to generate expiring links to binary images)

Coding time

Creating the thing took me about 2 days(didn't count how much exactly, but I assume that it was about 15-20 hours), most of the time was consumed by coding and trying new things (3/4 of the time I would say). Rest of the time was spent on writing tests, configuring docker and nginx.

Start things up

Project can be started using docker-compose up in main folder. There's ready .env file with some default data. Passwords and login data should probably be changed, but I left them to make starting project easier. Project starts at port 80, but It can be changed in docker-compose.yaml file. Admin panel is available at /admin, it's the easiest way to log-in using default credentials. Informations necessary to log in to admin panel (and to the browsable API in the browser) are SUPERUSER_NAME and SUPERUSER_PASSWORD from .env file.

image_api's People

Contributors

p2vvel avatar

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.