A reusable Django app for implementing a referral system.
It allows users to generate unique referral links and track sign-ups using those links.
- 🔗 Generate unique referral codes for each user
- 👥 Track referrals during user sign-up
- 🎁 Optionally reward users for successful referrals
- 🍪 Cookie & middleware support for referral tracking
- ⚡ Simple integration into existing Django projects
pip install django-referral2In settings.py:
INSTALLED_APPS = [
...
'referral', # Add this line
]python manage.py migrate referralIf you want cookie-based referral tracking:
MIDDLEWARE = [
...
'referral.middleware.ReferralMiddleware',
]If a user has referral_code="ABC123", their referral link is:
https://yourdomain.com/signup?ref=ABC123
When a new user signs up with a referral link:
- The app detects the referral code
- Links the new user to the referrer
- Saves the relationship in the database
Clone the repo and install dependencies:
git clone https://github.com/yourusername/django-referral-app.git
cd django-referral-app
pip install -r requirements.txtThis project is licensed under the MIT License.
For a complete implementation example, check the documentation.