Complete checklist for deploying Django applications to production on DigitalOcean or similar VPS.
- Code is committed to Git
- All tests passing
- Requirements.txt is up to date (
pip freeze > requirements.txt)
| `"""` | |
| `UptimeRobot Integration for Django` | |
| `===================================` | |
| `This gist contains code snippets for integrating UptimeRobot` | |
| `with your Django application, including:` |
| `"""` | |
| `Google Analytics 4 Integration for Django` | |
| `==========================================` | |
| `Complete code snippets for integrating Google Analytics 4 (GA4)` | |
| `with your Django application, including:` |
| """ | |
| Django Sentry Setup - Quick Integration | |
| ======================================== | |
| Drop this into your Django settings.py for instant Sentry error tracking. | |
| Only activates in production (DEBUG=False). | |
| Installation: | |
| pip install sentry-sdk python-decouple |
| """ | |
| Django Production Security Settings | |
| ==================================== | |
| Complete security configuration for production Django applications. | |
| Environment-aware: only enforces in production (DEBUG=False). | |
| Add to your settings.py after core settings. | |
| """ |
| """ | |
| Django Environment Configuration Template | |
| ========================================== | |
| Complete example of environment-based Django settings using python-decouple. | |
| Installation: | |
| pip install python-decouple | |
| Files needed: |
| """ | |
| Dynamic robots.txt for Django | |
| ============================== | |
| A simple Django view that generates robots.txt dynamically. | |
| Automatically includes your sitemap URL. | |
| Add to urls.py: | |
| from .views import robots_txt | |
| urlpatterns = [ |
| """ | |
| Complete Django SEO Sitemap Configuration | |
| ========================================== | |
| Comprehensive sitemap setup for Django with multiple content types. | |
| Installation: | |
| Add to INSTALLED_APPS: | |
| 'django.contrib.sites', | |
| 'django.contrib.sitemaps', |
| # Django Production Settings Template | |
| # Best practices for production Django configuration | |
| from pathlib import Path | |
| from decouple import config, Csv | |
| # Build paths | |
| BASE_DIR = Path(__file__).resolve().parent.parent | |
| # SECURITY WARNING: keep the secret key used in production secret! |
| # Gunicorn Systemd Service for Django | |
| # Save to: /etc/systemd/system/your-site.service | |
| # Enable with: sudo systemctl enable your-site && sudo systemctl start your-site | |
| [Unit] | |
| Description=Gunicorn daemon for Django Site | |
| After=network.target | |
| [Service] | |
| # User and group to run as |