Skip to content

melardev/DjangoRestShopApy

Repository files navigation

Introduction

This is one of my E-commerce API app implementations. It is written in python, using Django and DRF as the main frameworks. This is not a finished project by any means, but it has a valid enough shape to be git cloned and studied if you are interested in this topic. If you are interested in this project take a look at my other server API implementations I have made with:

WARNING

I have mass of projects to deal with so I make some copy/paste around, if something I say is missing or is wrong, then I apologize and you may let me know opening an issue.

Getting started

  1. Git clone the project
  2. In windows run reset_all.ps1, in linux reset_all.sh, or take line by line and execute them yourself in your terminal window, please notice that I run python3 in that script because this is how I set up my pc, but if your default python 3 is accessible with python then change it. This script is used to remove any migrations if any, remove the sqlite db if any, create the db and then migrate. At the end of this step you have a db.sqlite3.

TODO

  • Improve error messages, for example when commenting a product without a being authenticated the error structur is misleading, errors has to be a json object not a string.
  • The short url for comments, does not seem to work, /comments/:id does not work, but /products/:slug/comments/:pk does ... hum, fix it
  • Security:
    • Secure file upload
    • Secure all user input
    • CORS
  • then run server with python3 manage.py runserver 8080 It is convenient to use port 8080 because all the requests made in postman are using that port, the postman file is api.postman_collection.json, you can import it and test the requests by yourself -)

Features

  • Authentication / Authorization
  • Paging
  • Products, Orders, OrderItems, Addresses, Custom User model, Tags, Categories, Comments, TimestampedModel, FileUpload(Polymorphic)
  • Products associated to images, file upload without any 3party package
  • CRUD operations on products, comments, tags, categories Fetching products page
  • Orders, guest users may place an order Database diagram

What you will learn

  • Django

    • middlewares
    • authentication
    • authorization
  • Django ORM

    • associations: hasMany, belongsTo, belongsToMany
    • scopes
    • complex queries
    • paging
    • eager loading, select columns
  • seed data with python-faker

  • misc

    • project structure

Resources

Releases

No releases published

Packages

No packages published

Languages