This is the backend repository for Slash, a Django-based web application providing REST APIs for product management, cart, orders, payments, reviews, and authentication.
Before setting up the project, ensure you have the following installed on your system:
- Python (3.10+ recommended)
- Redis (Required for Celery background tasks and caching)
- Elasticsearch (Required for search functionalities)
- PostgreSQL (Optional; the app defaults to SQLite if Postgres is not configured)
-
Clone the repository
git clone <repository_url> cd slash
-
Set up a Virtual Environment It is highly recommended to use a virtual environment to manage dependencies:
python -m venv .venv source .venv/bin/activate -
Configure Environment Variables Copy the example environment file to
.envand fill in the necessary credentials (like Database, Redis URLs, Elasticsearch, Google OAuth, and Flutterwave keys):cp .env.example .env
-
Install Dependencies & Apply Migrations The project includes a
Makefileto simplify setup. The following command installs all dependencies fromrequirements.txtand runs the database migrations:make setup
-
Create an Admin Superuser To access the Django admin panel (
/admin/), you will need a superuser account:make superuser
-
Seed Initial Data (Optional) Run the following command to create initial product categories in your database:
make seed_categories
Ensure that your local Redis and Elasticsearch services are running before starting the application.
You can run the Django development server, Celery worker, and Celery beat concurrently using the Makefile:
make devIf you prefer to run the services in separate terminal windows:
- Django Server:
make run(orpython manage.py runserver) - Celery Worker:
make worker(orcelery -A core worker -l info) - Celery Beat:
make beat(orcelery -A core beat -l info)
To stop all background services started via make dev:
make stopmake help- View all available commandsmake test- Run the automated test suitemake shell- Open the interactive Django shellmake clean- Remove.pycand__pycache__files
- Framework: Django & Django REST Framework
- API Documentation: Generated via
drf-spectacular - Authentication: JWT authentication (
rest_framework_simplejwt) and Social Login (django-allauth/ Google OAuth) - Payments: Flutterwave integration
- Background Jobs: Celery & Redis (handles tasks like scheduled payment processing and training recommendation models)
- Admin Theme: Unfold