An simple POC eCommerce website backend, that supports add/search/delete/modify products functionality.
Demo App: http://amitt001.pythonanywhere.com
Docs: http://bit.ly/2eiXTD7
Python, Django, Django-rest, PyJWT
git clone https://github.com/amitt001/ecom_backend.git
To run tests, cd into ecom_api directory and run this command:
python manage.py test
Automatic:
1. chmod +x setup.sh 2. ./setup.sh
Manual:
1. Intall pip(`sudo apt-get/yum install pip`). 2. Install virtualenv(`sudo apt-get/yum install virtualenv`). 3. Create virtualenv and activate it(`virtualenv env && source env/bin/activate`). 4. Install required packages(`pip install -r requirements.txt`). 5. Goto ecom_api directory(`cd ecom_api`). 6. Create database(`python manage.py makemigrations && python manage.py migrate`). 7. Test and run(`python manage.py test && python manage.py runserver`)
By default, all the product management endpoints have IsAuthenticatedOrReadOnly permissions i.e. an anonymous/unauthenticated user can only see the product. For modifying product data(PUT, POST, DELETE) user need to register and use token.
To use django-rest UI for testing comment settings.py line 61 and uncomment line 62
This app uses SQLite as the database.
This app uses Django ORM for DB access. So, other SQL DBs like MySQL, PostgreSQL, etc can also be used just by adding the DB info in settings.py file(no need to change any code).