Django backend API for the NextPetBuddy application. This backend handles the management of pets, orders, and payments.
Ensure you have the following installed:
Additionally, configure the following environment variables in a .env
file:
SECRET_KEY=<Secret key>
DEBUG=<true or false - debug mode>
TRY_LOCAL_DB=<true or false - if false uses db set below>
TRY_LOCAL_STORAGE=<true or false - if false uses cloudinary storage set below>
TRY_LOCAL_EMAIL=<true or false - if false uses email settings set below>
DATABASES_DEFAULT_ENGINE=<Database engine - use this "django.db.backends.postgresql">
DATABASES_DEFAULT_NAME=<Database name>
DATABASES_DEFAULT_HOST=<Database host>
DATABASES_DEFAULT_PORT=<Database port>
DATABASES_DEFAULT_USER=<Database user>
DATABASES_DEFAULT_PASSWORD=<Database password>
PAYSTACK_SECRET_KEY=<Your Paystack secret key>
CLOUDINARY_STORAGE_CLOUD_NAME=<Storage name>
CLOUDINARY_STORAGE_API_KEY=<Storage API key>
CLOUDINARY_STORAGE_API_SECRET=<Storage API secret>
EMAIL_HOST=<Email host>
EMAIL_HOST_USER=<Email user>
EMAIL_HOST_PASSWORD=<Email password>
EMAIL_PORT=<Email port>
EMAIL_USE_TLS=<true or false - email use TLS>
ALLOWED_HOST=<domain the backend is hosted on>
FRONTEND_BASE_URL=<domain of frontend>
-
Clone the repository:
git clone https://github.com/Maxzeno/nextpetbuddyapi.git cd nextpetbuddyapi
-
Create a virtual environment: It's recommended to create a virtual environment for your project:
python -m venv env
-
Activate the virtual environment:
- On Windows:
env\Scripts\activate.bat
- On macOS/Linux:
source env/bin/activate
- On Windows:
-
Install dependencies: Install the necessary Python packages by running:
pip install -r requirements.txt
-
Apply database migrations: Run the following command to apply the migrations:
python manage.py migrate
-
Run the server locally: After installing dependencies and applying migrations, you can start the Django development server by running:
python manage.py runserver
The API will be accessible at
http://localhost:8000/
.