Movie Shop - Simple shop api with CRUD operations
How to setup and test the application
-
Install pip first using this command
sudo apt-get install python3-pip
-
Install virtualenv using pip3
sudo pip3 install virtualenv
-
Create a virtual environment
virtualenv venv
-
Activate your virtual environment:
source venv/bin/activate
-
Clone this repo with the following command:
git clone https://github.com/Nyakaru/movie-shop.git
-
Cd into the movieshop directory:
cd movieshop
-
Install the requirements by running the command:
pip install
-
Create a database: In the terminal run the following after installing postgres and setting up:
psql
create DATABASE <name_of_your_database>
-
Create a .env file in the project folder and and the following exports:
export DATABASE="<name of your database>"
export USER="<your postgres username>"
export HOST="<localhost>"
export PASSWORD="<your postgres password>"
-
Export the settings by running the command:
source .env
-
Migrate the database:
python manage.py makemigrations
python manage.py migrate
-
Run the server:
python manage.py runserver
-
Access the endpoints via:
- Web browser(Swagger) - http://127.0.0.1:8000/docs/
- Postman - http://127.0.0.1:8000/api