🚀 Build a Dynamic Django Portfolio with reCAPTCHA, Auto-Email, and Secure Admin Panel

HomePortfolio
Learn how I built my own Django portfolio site from scratch with modern security, reCAPTCHA, and email features!

Welcome to my open-source Django portfolio project! This is more than just a website—it's a feature-rich, production-ready portfolio with a secure contact form, reCAPTCHA, email automation, and a custom admin panel. Whether you're a beginner or looking to scale your portfolio, this guide walks you through the complete setup.

🧱 Project Overview

This project is built with Django (Python) and includes all essential features a modern portfolio site needs: - Secure admin login via /admin/ - Dynamic contact form with automatic responses - Google reCAPTCHA v2 integration to stop bots - Email notifications to both admin and sender - Static file collection for deployment - SQLite support (easily swappable with PostgreSQL or MySQL)

⚙️ Installation & Setup

Let’s get your local environment ready with this step-by-step guide. These steps assume you have Python and Git installed.

bash
# 1. Clone the Repo
git clone https://github.com/vamsikrishna7-github/vamsikrishna.site.git
cd vamsikrishna.site

# 2. Create Virtual Environment
python -m venv vamsi
source vamsi/bin/activate      # Mac/Linux
vamsi\Scripts\activate         # Windows

# 3. Install Dependencies
pip install -r requirements.txt

# 4. Migrate the Database
python manage.py migrate

# 5. Create Superuser for Admin Panel
python manage.py createsuperuser

# 6. Collect Static Files
python manage.py collectstatic

# 7. Start the Server
python manage.py runserver

🔐 reCAPTCHA Integration

To prevent spam and abuse in your contact form, Google reCAPTCHA is used. Follow these steps: 1. Register your site at Google reCAPTCHA. 2. Get your Site Key and Secret Key. 3. Add them to settings.py.

python
# settings.py
RECAPTCHA_PUBLIC_KEY = "your_site_key"
RECAPTCHA_PRIVATE_KEY = "your_secret_key"

📧 Gmail SMTP for Auto Email

When a user submits the contact form, both the admin and user receive an email confirmation. This is configured with Gmail SMTP. 1. Enable 2FA on your Gmail 2. Generate an App Password 3. Add this to settings.py

python
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-app-password'

🌍 Deployment-Ready Settings

Prepare your Django app for production on platforms like Render, Railway, or Heroku. You must add your domain to ALLOWED_HOSTS and enable HTTPS redirect:

python
ALLOWED_HOSTS = [
    "vamsikrishna.site",
    "www.vamsikrishna.site",
    "blog.vamsikrishna.site"
]

# Security Settings
SECURE_SSL_REDIRECT = True
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")

🎉 Final Thoughts

This project was built to showcase not just my skills—but also how developers can level up their portfolio game with secure, full-stack, production-grade features. Feel free to fork and enhance it for your own use. Contributions welcome!

👉 Fork on GitHub :https://github.com/vamsikrishna7-github/vamsikrishna.site


Likes • 15 Views • Apr 4, 2025