HOMESCREEN | DASHBOARD | PROFILE |
---|---|---|
CATEGORY | HELP_LIBRARY | PAYMENT |
CREDITCARD | MESSAGING | RECENTLY_VIEWED |
BUYITNOW | COMMENTS | RECENT_ACTIVITY |
This is a Django-based web application for online auctions. Users can create listings, bid on items, add items to their watchlist, and interact with other users through a messaging system. The application now includes payment processing integration with PayPal and Stripe.
- User authentication (register, login, logout)
- Create, edit, and close auction listings
- Bid on active auctions
- Add items to a personal watchlist
- Comment on auction listings
- User messaging system
- User profiles with auction statistics
- Categories for organizing listings
- Dashboard with auction statistics and charts
- Responsive design for mobile and desktop
- Payment processing with PayPal and Stripe
- Photo uploads for auction listings and user profiles
- Django 3.x
- Python 3.x
- HTML5
- CSS3
- JavaScript
- Bootstrap 4
- SQLite (default database)
- PayPal SDK
- Stripe API
-
Clone the repository:
git clone https://github.com/Sacred-G/commerce.git cd commerce
-
Create a virtual environment and activate it:
python -m venv auctionenv source auctionvenv/bin/activate # On Windows use `auctionenv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Set up environment variables for PayPal and Stripe:
export PAYPAL_CLIENT_ID=your_paypal_client_id export PAYPAL_SECRET=your_paypal_secret export STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key export STRIPE_SECRET_KEY=your_stripe_secret_key
-
Run migrations:
python manage.py migrate
-
Create a superuser:
python manage.py createsuperuser
-
Run the development server:
python manage.py runserver
-
Open a web browser and navigate to
http://127.0.0.1:8000/
To enable photo uploads for auction listings and user profiles:
-
Update your settings.py:
MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
-
Update your main urls.py to serve media files during development:
from django.conf import settings from django.conf.urls.static import static if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
-
Add ImageField to your models:
from django.db import models class AuctionListing(models.Model): # ... other fields ... image = models.ImageField(upload_to='auction_images/', blank=True, null=True) class Profile(models.Model): # ... other fields ... profile_picture = models.ImageField(upload_to='profile_pics/', blank=True, null=True)
-
Install Pillow for image processing:
pip install Pillow
-
Update your forms to include file upload fields:
from django import forms from .models import AuctionListing, Profile class AuctionListingForm(forms.ModelForm): class Meta: model = AuctionListing fields = ['title', 'description', 'starting_bid', 'image', ...] class ProfileForm(forms.ModelForm): class Meta: model = Profile fields = ['bio', 'profile_picture', ...]
-
In your templates, use the correct enctype for file uploads:
<form method="post" enctype="multipart/form-data"> {% csrf_token %} {{ form.as_p }} <button type="submit">Submit</button> </form>
-
Display images in your templates:
{% if auction.image %} <img src="{{ auction.image.url }}" alt="{{ auction.title }}"> {% endif %}
Remember to handle cases where images might not exist to avoid errors in your templates.
- Register a new account or log in
- Create new auction listings with photos
- Browse active auctions
- Place bids on items
- Add items to your watchlist
- Leave comments on auction pages
- Use the messaging system to contact other users
- View and update your profile, including profile picture
- Process payments using PayPal or Stripe when winning an auction
Thanks to BobsProgrammingAcademy for the dashboard. His work inspired the design
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.