Files
company_site/.env.prod.example
T
westfarn b98f504afc
Unit Tests / test (push) Successful in 11s
Admin Stripe invoices + recurring subscriptions (customers pay us) (#24)
## Summary
- Closes #23
- Admin-only invoice dashboard under `/financial/invoices` (superuser)
- One-off Stripe hosted invoices + email pay link (customers pay us)
- Monthly (or weekly/yearly) Stripe Checkout subscriptions + email checkout link
- Webhook at `/financial/stripe/webhook/` syncs invoice/subscription status
- Env docs: `STRIPE_SECRET_KEY`, `STRIPE_PUBLISHABLE_KEY`, `STRIPE_WEBHOOK_SECRET`

## Test plan
- [ ] Set Stripe **test** keys in local `.env` and restart app
- [ ] As superuser: Dashboard → Invoices → create one-off invoice; confirm Stripe invoice + email
- [ ] As superuser: create monthly subscription; open Checkout link; complete with test card `4242…`
- [ ] Configure Stripe CLI or Dashboard webhook → confirm status updates to paid/active
- [ ] Non-admin user cannot open `/financial/invoices`
- [ ] Prod: add live keys + webhook secret to server `.env`, migrate, restart; point webhook to `https://aimloperations.com/financial/stripe/webhook/`

## Notes
Uses stdlib HTTP to Stripe API (no `stripe` PyPI package) so deploys stay dependency-light.Reviewed-on: #24
2026-07-31 12:02:40 -07:00

56 lines
2.1 KiB
Bash

# Server-side production environment file.
# Copy to /home/westfarn/Documents/django_live_sites/Company_Site/.env
# This file is NOT deployed from git — rsync excludes .env so server values persist.
# Environment level: dev | beta | prod
DJANGO_ENV=prod
DJANGO_DEBUG=false
DJANGO_SECRET_KEY=replace-with-a-long-random-secret
DJANGO_ALLOWED_HOSTS=aimloperations.com,www.aimloperations.com
# Optional override; when unset, https:// origins are derived from DJANGO_ALLOWED_HOSTS.
# DJANGO_CSRF_TRUSTED_ORIGINS=https://aimloperations.com,https://www.aimloperations.com
# Logging (optional override; defaults: dev=DEBUG, beta=INFO, prod=WARNING)
# DJANGO_LOG_LEVEL=WARNING
# PostgreSQL — DATABASE_URL is used by Django; DB_* are used by the db container.
DATABASE_URL=postgres://company_site:replace-db-password@db:5432/company_site
DB_NAME=company_site
DB_USER=company_site
DB_PASSWORD=replace-db-password
# Analytics
TIANJI_ENABLED=true
TIANJI_TRACKER_URL=https://tianji.aimloperations.com/tracker.js
TIANJI_WEBSITE_ID=replace-with-production-website-id
# reCAPTCHA
RECAPTCHA_PUBLIC_KEY=replace-with-production-public-key
RECAPTCHA_PRIVATE_KEY=replace-with-production-private-key
# Email (SMTP2GO)
EMAIL_HOST=mail.smtp2go.com
EMAIL_HOST_USER=replace-with-smtp-user
EMAIL_HOST_PASSWORD=replace-with-smtp-password
EMAIL_PORT=2525
EMAIL_USE_TLS=true
# DEFAULT_FROM_EMAIL=AI ML Operations, LLC <info@aimloperations.com>
# Stripe (live keys from https://dashboard.stripe.com/apikeys)
# Secret key starts with sk_live_; publishable with pk_live_
STRIPE_SECRET_KEY=replace-with-stripe-secret-key
STRIPE_PUBLISHABLE_KEY=replace-with-stripe-publishable-key
# Dashboard → Developers → Webhooks → endpoint
# URL: https://aimloperations.com/financial/stripe/webhook/
# Events: invoice.paid, invoice.payment_failed, invoice.finalized,
# customer.subscription.updated, customer.subscription.deleted,
# checkout.session.completed
STRIPE_WEBHOOK_SECRET=replace-with-stripe-webhook-signing-secret
# Gunicorn
GUNICORN_WORKERS=2
GUNICORN_BIND=0.0.0.0:8000
# Host port exposed by docker-compose.prod.yml
WEB_PORT=8000