AI-powered lead capture and coming soon pages for Django with LiteLLM integration
Project description
django-lead-capture
Django app for creating AI-powered lead capture and "coming soon" landing pages with email collection, verification, and analytics.
Features
- 🤖 AI-Powered Copy Generation - Automatically generate compelling landing page copy using LiteLLM (OpenAI, Anthropic, Groq, etc.)
- 📧 Email Capture & Verification - Collect and verify email addresses with automated welcome emails
- 📊 Analytics Dashboard - Track page views, conversion rates, and lead sources
- 📤 CSV Export - Export leads for email marketing platforms
- ⏱️ Countdown Timers - Optional launch countdown functionality
- 👥 Social Proof - Display lead counts to increase conversions
- 🎨 Bootstrap 5 Templates - Clean, responsive landing pages out of the box
- 🛡️ Spam Protection - Honeypot fields and duplicate detection
- ⚙️ Django Admin Integration - Manage campaigns and configuration via Django admin
Installation
pip install django-lead-capture
Or with uv:
uv add django-lead-capture
Quick Start
1. Add to INSTALLED_APPS
# settings.py
INSTALLED_APPS = [
# ...
'django_lead_capture',
'solo', # Required dependency
'django_bootstrap5', # Required dependency
]
2. Include URLs
# urls.py
from django.urls import path, include
urlpatterns = [
# ...
path("", include("django_lead_capture.urls")),
]
3. Run Migrations
python manage.py migrate
4. Configure LLM API Key
After running the server, you'll see a system check warning:
? django_lead_capture.W001: Lead Capture API key not configured
HINT: Configure your LLM API key in Django Admin: Lead Capture Configuration
Go to Django Admin → Lead Capture Configuration and enter:
- API Key: Your LiteLLM-compatible API key (OpenAI, Anthropic, Groq, etc.)
- Model Name: e.g.,
gpt-4,claude-3-sonnet-20240229,groq/llama-3.1-8b-instant - API Endpoint (optional): Custom endpoint if using a proxy
5. Create a Campaign
- Go to Django Admin → Lead Capture → Campaign wizard
- Fill out the questionnaire about your product
- AI will generate optimized copy
- Customize and activate your campaign
Configuration
The package uses Django Solo for configuration. All settings are managed through the Django admin interface.
LiteLLM Model Examples
OpenAI:
gpt-4orgpt-4o-mini
Anthropic:
claude-3-opus-20240229claude-3-sonnet-20240229
Groq:
groq/llama-3.1-8b-instantgroq/compound
Custom/Proxy:
- Set
api_endpointto your proxy URL - Use any LiteLLM-compatible model identifier
See LiteLLM docs for the full list of supported providers.
Usage
Campaign Creation Workflow
- Wizard (
/lead-capture/wizard/) - Staff-only questionnaire - Edit - Customize AI-generated copy
- Preview - Test before going live
- Activate - Make campaign public
- Analytics - Track performance
Public Campaign URLs
Campaigns are available at: /launch/{slug}/
Example: /launch/my-awesome-product/
Email Verification
Welcome emails include a verification link: /verify/{token}/
CSV Export
Use the Django admin action "Export selected leads to CSV" to export lead data.
Templates
All templates extend base.html. Override them by creating files in your project's templates directory:
your_project/templates/django_lead_capture/
├── wizard.html # Campaign creation form
├── edit.html # Edit campaign
├── preview.html # Preview campaign
├── campaign.html # Public landing page
├── thank_you.html # Post-submission page
├── list.html # Campaign list
├── analytics.html # Analytics dashboard
├── no_models.html # API key not configured
└── emails/
└── welcome.html # Welcome email template
Models
ComingSoonCampaign
Core model for lead capture campaigns with fields for:
- Generated content (headline, subheadline, benefits, etc.)
- SEO metadata
- Display options (countdown, social proof)
- Analytics (page views, conversion tracking)
Lead
Email capture model with:
- Email verification status
- Traffic source tracking
- IP address and user agent
- Timestamps
LeadCaptureConfiguration
Singleton model for LLM configuration:
- API key
- Model name
- Custom API endpoint
Email Configuration
Make sure Django email settings are configured:
# settings.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'your-email@gmail.com'
EMAIL_HOST_PASSWORD = 'your-password'
DEFAULT_FROM_EMAIL = 'noreply@yourdomain.com'
System Checks
The package includes a Django system check that warns if the API key is not configured. This is non-blocking - the app will still work, but the AI wizard will not function until configured.
Development
Running Tests
python manage.py test django_lead_capture
Local Development
The package uses UV for development. Clone the repository and:
uv sync
uv run python manage.py migrate
uv run python manage.py runserver
Requirements
- Django >= 4.2
- Python >= 3.10
- django-solo >= 2.0
- litellm >= 1.0
- django-bootstrap5 >= 24.0
License
MIT License - see LICENSE file for details
Contributing
Contributions welcome! Please open an issue or pull request.
Support
- Issues: GitHub Issues
- Docs: Full Documentation
Credits
Built by SimpleCTO for the Directory Platform project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_lead_capture-0.1.0.tar.gz.
File metadata
- Download URL: django_lead_capture-0.1.0.tar.gz
- Upload date:
- Size: 35.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7410aa6a889267f8934cf012162b085209842d937326ffd5565d5ca106a9be5c
|
|
| MD5 |
a937e21aabb419fd116eb4b27f28f073
|
|
| BLAKE2b-256 |
2225687cce9787fcb3220a2bb787e91d94be4dac051addbbb1e68eb89e52ff87
|
Provenance
The following attestation bundles were made for django_lead_capture-0.1.0.tar.gz:
Publisher:
publish.yml on heysamtexas/django-lead-capture
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_lead_capture-0.1.0.tar.gz -
Subject digest:
7410aa6a889267f8934cf012162b085209842d937326ffd5565d5ca106a9be5c - Sigstore transparency entry: 628820271
- Sigstore integration time:
-
Permalink:
heysamtexas/django-lead-capture@b73f38f64687d850286bb32e0064c6fd439976de -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/heysamtexas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b73f38f64687d850286bb32e0064c6fd439976de -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_lead_capture-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_lead_capture-0.1.0-py3-none-any.whl
- Upload date:
- Size: 47.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b670cfc929c8db9ebebf27636be4b3cedd113609a42df702c8809dafdce43b2
|
|
| MD5 |
b46677a568986636abba18b90d64170f
|
|
| BLAKE2b-256 |
8a0f2b8b2c0584d00aec6757314317349df08f649e322b493007457cf8627404
|
Provenance
The following attestation bundles were made for django_lead_capture-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on heysamtexas/django-lead-capture
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_lead_capture-0.1.0-py3-none-any.whl -
Subject digest:
4b670cfc929c8db9ebebf27636be4b3cedd113609a42df702c8809dafdce43b2 - Sigstore transparency entry: 628820274
- Sigstore integration time:
-
Permalink:
heysamtexas/django-lead-capture@b73f38f64687d850286bb32e0064c6fd439976de -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/heysamtexas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b73f38f64687d850286bb32e0064c6fd439976de -
Trigger Event:
release
-
Statement type: