- .env file wthin restful_ecom is for local installation
- .env file in the root directory is for docker based deployment
- please note that postgres has been used as database
- Clone the following repository,
git clone https://github.com/mohammadjayeed/restful_ecommerce.git
- Make a virtual environment with the following command
python -m venv venv
- Activate the virtual environment with the command
venv/scripts/activate or source venv/bin/activate (for linux)
- Install dependencies
pip install -r requirements.txt
- Run the following command to apply it to the database
python manage.py migrate
- Run the following command to create a superuser to access admin panel by adding the required information. We will require username and password to login to the admin panel
python manage.py createsuperuser
- Start the application by typing the following command
python manage.py runserver
-
Make sure you have docker installed on your machine
-
From the terminal, input these commands:
docker compose up --build
- Finally create a superuser (if you would like to) with the following commands:
docker exec -it <container_id_or_name> /bin/bash
A prompt will show up. Type:
python manage.py createsuperuser
- Provide user credentials as necessary
- While implementing order placement endpoint , had to go through some rigorous edge case checking
- postgres library has two binaries - one for windows which might psycopg , for linux psycopg-binary
- Initially tried Swagger Documentation, but it did not grab api endpoints or let me implement image attachment unless class based views are used; as a result switched to postman documentation, which is more robust and friendly (in my opinion)
- Stripe webhook might be considered as an obstacle for local development, though I implemented it perfectly and also received response 200 in the cli; subsequently an order was auto placed.