An online auction platform built with Django, Django REST Framework, Celery, and Redis, allowing users to list items, place bids, and manage auctions with background tasks.
- User Authentication: Custom user model with email-based authentication, including registration, login, and password reset.
- Item Management: Users can create, view, update, and delete items they own.
- Auction Management: Users can initiate auctions, set starting bids, and specify end times.
- Bidding: Users can place bids on active auctions, with validation to ensure bids are above the current highest bid.
- Background Tasks: Celery is used with Redis as the message broker for handling asynchronous tasks, like sending email notifications for password resets and auction reminders.
- Password Reset: Users can request password reset emails, with verification codes stored in cache.
- Item Transfer: Auction items can be transferred between users once an auction is completed successfully.
- Email Notifications: Automatic email notifications for auction updates, bid confirmations, and auction reminders.
-
Clone the Repository
git clone <repo link> cd AuctionHub
-
Install Dependencies
pip install -r requirements.txt
-
Run Migrations
python manage.py migrate
-
Set Up Redis
Ensure that Redis is installed and running. You can install it via package managers (e.g.,brew install redis
for macOS,sudo apt install redis-server
for Ubuntu) and start the server:redis-server # by docker docker run -p 6379:6379 redis:7.0.5-alpine
-
Start Celery
Open a new terminal and run Celery with the Redis broker:celery -A auctionhub worker -l info celery -A auctionhub beat --loglevel=info
-
Run the Server
python manage.py runserver
This project uses Celery for handling background tasks, such as sending email notifications for password resets and auction-related reminders. Redis acts as the message broker for Celery to manage task queues and results.
- Install Celery and Redis:
pip install celery redis
- Configuration: Celery and Redis configurations are set in Django’s
settings.py
file. - Running Celery: After setting up Redis, start a Celery worker to listen for tasks, as shown in step 5 above.
- Password Reset: Celery handles email notifications for password reset requests.
- Auction Notifications: Set automated reminders and notifications for auction events.
- Item Transfer Notifications: Notifications when items are successfully transferred to the winning bidder.
POST ${BaseUrl}/api/register/
: Register a new userPOST ${BaseUrl}/api/login/
: Log in a userPOST ${BaseUrl}/api/change_password/
: Change the passwordPOST ${BaseUrl}/api/forgot_password/
: Request a password reset email and check the email to reset forgotten password
GET ${BaseUrl}/api/items/
: List all itemsPOST ${BaseUrl}/api/items/
: Create a new item (authenticated users only)PATCH ${BaseUrl}/api/items/<item_id>/
: Update item details (owner only)DELETE ${BaseUrl}/api/items/<item_id>/
: Delete an item (owner only)
GET ${BaseUrl}/api/auctions/
: List all active auctionsPOST ${BaseUrl}/api/auctions/
: Create a new auction (authenticated users only)PATCH ${BaseUrl}/api/auctions/<auction_id>/
: Update auction details (owner only)DELETE ${BaseUrl}/api/auctions/<auction_id>/
: Cancel an auction (owner only)
POST ${BaseUrl}/api/auctions/<auction_id>/bid/
: Place a bid on an auctionGET ${BaseUrl}/api/auctions/<auction_id>/bid/
: List all bids for an auction
POST ${BaseUrl}/api/auctions/<auction_id>/complete/
: Transfer the item to the winner (completed auction)GET ${BaseUrl}/api/items/transfer/
: View items that have been transferred
- Register and Log In: First, register an account and log in to access the auction features.
- List an Item: Use the
/items/
endpoint to create an item you wish to auction. - Start an Auction: Use the
/auctions/
endpoint to start an auction with a starting bid and an end time. - Place a Bid: Bidders can place bids on active auctions using the
/auctions/<auction_id>/bid/
endpoint. - Complete Auction: After an auction ends, use the
/complete/
endpoint to transfer the item to the winning bidder. - Receive Notifications: Get email notifications for auction updates, bid confirmations, and reminders.