A Django-based ecommerce site for selling one-off personal items using Stripe Payment Links.
- Customer views items nice and simple catalogue
- Clicks "Buy Now" button (only shown for Live items)
- Redirected to Stripe Payment Link
- Completes payment on Stripe
- Stripe sends webhook to
/store/webhooks/stripe/to handle marking items as Sold and sending confirmation emails (if configured) - Item remains visible in catalogue but shows "Sold" badge (shows people what they're missing out on!)
- Optimised for viewing and creating new items via mobile - there's a nice item upload form with mobile camera support for logged-in admins
- Catalogue has quick catagory filters, and shows sold items to
- Use the Django admin to manage items in detail
- Items support multiple images and little feature to set the primary image
- Python 3.9 or higher
- pip
- Stripe account (for testing)
-
Clone the repository:
git clone <repository-url> cd sellmystuff
-
Create and activate virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
Create a
.envfile in the project root with the following variables:Required:
SECRET_KEY=your-secret-key-here STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret ITEM_UPLOAD_PASSWORD=your-password-here
Optional (for email notifications):
EMAIL_HOST=smtp-relay.brevo.com EMAIL_PORT=587 EMAIL_HOST_USER=your-brevo-email@example.com EMAIL_HOST_PASSWORD=your-brevo-smtp-key EMAIL_USE_TLS=True DEFAULT_FROM_EMAIL=your-verified-sender@yourdomain.com ADMIN_EMAIL=admin@example.com
Note: See STRIPE_SETUP.md for detailed instructions on getting your Stripe keys. See Email Configuration below for email setup details.
-
Set up database:
python manage.py migrate python manage.py createsuperuser
-
Start the development server:
python manage.py runserver
-
Access the site:
- Frontend: http://127.0.0.1:8000/
- Admin: http://127.0.0.1:8000/admin/
SECRET_KEY- Django secret key for cryptographic signing. Generate a secure random string (e.g., usepython -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())").STRIPE_SECRET_KEY- Your Stripe API secret key (starts withsk_test_for test mode,sk_live_for production). Get from Stripe Dashboard → Developers → API keys.STRIPE_WEBHOOK_SECRET- Webhook signing secret (starts withwhsec_). See STRIPE_SETUP.md for how to get this.ITEM_UPLOAD_PASSWORD- Password required to access the/add-item/web form for creating items via the mobile interface.
Email notifications are sent when items are sold. The site works without email configuration, but notifications won't be sent.
EMAIL_HOST- SMTP server hostname (default:smtp-relay.brevo.comfor Brevo)EMAIL_PORT- SMTP server port (default:587)EMAIL_USE_TLS- Enable TLS encryption (default:True)EMAIL_HOST_USER- SMTP username (your Brevo email or API key)EMAIL_HOST_PASSWORD- SMTP password (your Brevo SMTP key)DEFAULT_FROM_EMAIL- Email address that appears as the sender (must be verified in your email service)ADMIN_EMAIL- Email address to receive sale notifications (admin notifications)
See Email Configuration below for setup instructions.
For detailed Stripe setup instructions, including webhook configuration for local development and production, see STRIPE_SETUP.md.
The site sends email notifications when items are sold:
- Buyer confirmation email - Sent to the customer who purchased the item
- Admin notification email - Sent to the admin email address with purchase details
When a payment is completed via Stripe webhook:
- The webhook handler processes the
checkout.session.completedevent - Item is marked as SOLD
- Email notifications are sent to both buyer and admin (if email is configured)
- Emails include item details, buyer information (name, email, phone), and pickup instructions
Brevo is a straight-foward service to use, mostly because they offer a free tier with 300 emails/day.
Note that you'll need your own domain to connect with Brevo.
- Sign up at Brevo: https://www.brevo.com/
- Verify your sender email:
- Go to Settings → Senders
- Add and verify the email address you want to use as the sender
- Get SMTP credentials:
- Go to Settings → SMTP & API
- Copy your SMTP server, port, and credentials
- Add to
.envfile:EMAIL_HOST=smtp-relay.brevo.com EMAIL_PORT=587 EMAIL_HOST_USER=your-brevo-email@example.com EMAIL_HOST_PASSWORD=your-brevo-smtp-key EMAIL_USE_TLS=True DEFAULT_FROM_EMAIL=your-verified-sender@yourdomain.com ADMIN_EMAIL=admin@example.com
You can use any SMTP service (Gmail, SendGrid, Mailgun, etc.) by updating the email environment variables accordingly. The site uses Django's standard SMTP backend.
To test email sending:
python manage.py shellfrom django.core.mail import send_mail
from django.conf import settings
send_mail(
'Test Subject',
'Test message',
settings.DEFAULT_FROM_EMAIL,
[settings.ADMIN_EMAIL],
fail_silently=False,
)If email is configured correctly, this will send a test email and return 1 (success).
Buyer Email:
- Subject: "Thanks for your purchase: [Item Title]"
- Includes: Item details, price, pickup instructions
- Sender name: "Julia and Bryn"
Admin Email:
- Subject: "Item Sold: [Item Title]"
- Includes: Item details, buyer information (name, email, phone), sale timestamp
- Includes link to Django admin for the item
sellmystuff/
├── sellmystuff/ # Project settings
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── store/ # Main store app
│ ├── models.py # Item, ItemImage models
│ ├── views.py # Views for listing and detail
│ ├── urls.py # URL routing
│ ├── admin.py # Admin with Stripe integration
│ ├── stripe_service.py # Stripe Payment Link creation
│ └── webhooks.py # Stripe webhook handlers
├── templates/ # HTML templates
├── static/ # CSS, JS, images
└── manage.py
Via Web Form:
- Navigate to
/add-item/ - Enter the upload password
- Fill in the form and upload images
- Submit - item and Stripe Payment Link are created automatically
Via Admin:
- Log into Django admin
- Go to Store → Items → Add Item
- Fill in title, description, category (optional), and price
- Upload one or more images
- Save - a Stripe Payment Link will be created automatically
- Payment Links are created automatically when you save a new item
- Webhooks are the source of truth - items are marked SOLD via webhook, not frontend logic
- Sold items stay visible - they remain on the site with a "Sold" badge
- One payment per item - the webhook ensures items can only be sold once
- No cart functionality - each item is purchased individually
This project is licensed under the GNU General Public License v3.0 (GPL-3.0).