Skip to content

exul4nzs/Task-Mgmt-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

📚 Task Management System - Learning Journey

A complete web application built from scratch to learn Django, web development, and full-stack concepts.

This is NOT just a project - it's a learning resource for understanding how modern web applications work. Everything here is explained so you can understand and build similar apps in the future.


🎯 What You'll Learn From This Project

Backend (Server-Side with Django)

1. User Authentication System 📖

Location: authentication/ folder

What to Study:

  • models.py - Understand Django's User model and database concepts
  • forms.py - Learn form validation and custom form classes
  • views.py - See how to handle registration, login, email sending
  • urls.py - Understand URL routing (how URLs map to functions)

Key Concepts:

  • How passwords are hashed and stored securely
  • Email verification and token generation
  • User session management
  • Form validation on both client and server side

2. Database Design 🗄️

Location: tasks/models.py

What to Study:

  • Task model definition (title, description, status, priority, due_date)
  • Relationships (ForeignKey - linking tasks to users)
  • Model methods (get_status_color, get_priority_color)
  • Meta classes for ordering and display

Key Concepts:

  • Object-Relational Mapping (ORM) - Django's way of managing databases
  • Data types and field validation
  • Database migrations (how changes are tracked)

3. View Logic 🔄

Location: tasks/views.py

What to Study:

  • @login_required decorator - protecting pages from unauthenticated users
  • QuerySets - filtering database data
  • POST vs GET requests
  • Redirects and message handling
  • CRUD operations (Create, Read, Update, Delete)

Key Concepts:

  • Request/Response cycle
  • Data filtering and sorting
  • User isolation (each user only sees their data)
  • Error handling

4. URL Routing 🛣️

Location: core/urls.py and tasks/urls.py

What to Study:

  • How Django maps URLs to view functions
  • Named URL patterns (using name= parameter)
  • URL parameters (<int:pk> for task ID)
  • App-level vs project-level routing

Key Concepts:

  • RESTful URL design
  • URL patterns and regex
  • Namespace organization

Frontend (Client-Side with HTML/CSS)

5. Template System 📄

Location: templates/ folder

What to Study:

  • base.html - Base template inheritance (DRY principle)
  • tasks/task_list.html - Complex template with loops and conditionals
  • tasks/task_form.html - Form rendering and error displays
  • Template tags: {% if %}, {% for %}, {% url %}

Key Concepts:

  • Template inheritance (extending base template)
  • Template variables and context data
  • Conditional rendering
  • Forms in templates
  • CSRF protection tokens

6. CSS Styling 🎨

Location: static/css/style.css

What to Study:

  • CSS variables (:root) for consistent colors
  • Flexbox and Grid layouts
  • Responsive design (@media queries)
  • Animations and transitions
  • Bootstrap 5 integration
  • Custom component styling

Key Concepts:

  • CSS specificity
  • How to override Bootstrap defaults
  • Mobile-first responsive design
  • Gradient backgrounds and shadows
  • Accessibility (colors, contrast)

7. Bootstrap Framework 🧩

Location: All HTML templates

What to Study:

  • Grid system (rows and columns)
  • Component styling (buttons, cards, forms)
  • Utility classes (margins, padding, text alignment)
  • Responsive helpers (hiding/showing on mobile)

Key Concepts:

  • Pre-built component reuse
  • Framework customization
  • Responsive web design

📁 Project Structure Explained

myapp/
│
├── 📂 core/                    [PROJECT CONFIGURATION]
│   ├── settings.py            → Database, installed apps, email config
│   ├── urls.py                → Main URL router (entry point)
│   └── wsgi.py                → Web server entry point
│
├── 📂 authentication/          [USER AUTH SYSTEM - Study This First!]
│   ├── models.py              → User model (extends Django's User)
│   ├── views.py               → Register, Login, Password Reset logic
│   ├── forms.py               → Form validation for login/register
│   ├── urls.py                → Auth URLs (/login, /register, etc)
│   ├── templates/             → Login/Register HTML pages
│   └── migrations/            → Database change history
│
├── 📂 tasks/                   [TASK MANAGEMENT SYSTEM - Study Second!]
│   ├── models.py              → Task model with fields/methods
│   ├── views.py               → Task CRUD operations (Create, Read, Update, Delete)
│   ├── forms.py               → Task form validation
│   ├── urls.py                → Task URLs (/tasks, /tasks/create, etc)
│   ├── admin.py               → Django admin interface
│   ├── templates/             → Task HTML pages
│   └── migrations/            → Database changes
│
├── 📂 static/
│   └── css/
│       └── style.css          → Custom CSS styling (study for design!)
│
├── 📂 templates/              [HTML FILES]
│   ├── base.html              → Main template (navbar, footer, layout)
│   ├── homepage.html          → Landing page
│   └── tasks/                 → Task-specific templates
│
├── manage.py                  → Command-line tool for Django
├── requirements.txt           → Python packages needed
└── db.sqlite3                 → Database file (auto-created)

🏫 Learning Path (Recommended Order)

Week 1: Foundations

  1. Read: core/settings.py - Understand what gets configured
  2. Learn: What is Django and why we use it
  3. Study: authentication/models.py - Understand database models
  4. Play: Make a simple model with different field types

Week 2: Forms & Validation

  1. Study: authentication/forms.py - How forms validate data
  2. Learn: Widget attributes and form rendering
  3. Modify: Change form fields to see what happens
  4. Practice: Create a custom form validation

Week 3: Views & Logic

  1. Study: authentication/views.py - How request/response works
  2. Learn: Decorators like @login_required
  3. Trace: Follow a registration request from form to database
  4. Practice: Add a new view function

Week 4: Frontend

  1. Study: templates/base.html - Template inheritance
  2. Learn: Bootstrap grid system basics
  3. Experiment: static/css/style.css - Change colors and layouts
  4. Build: Create a new HTML page from scratch

Week 5: Complete CRUD

  1. Study: tasks/views.py - All CRUD operations
  2. Learn: QuerySet filtering and ordering
  3. Practice: Create a new feature (e.g., task search)
  4. Build: Your own mini-feature

Week 6+: Polish & Deploy

  1. Learn: Security best practices
  2. Study: How to optimize queries
  3. Practice: Add tests
  4. Build: Deploy to a real server

🔍 Code Study Guide

Start Here: Authentication System

File: authentication/views.py (Lines 1-60)

# STUDY THIS:
# - How @login_required protects pages
# - How form.is_valid() validates user input
# - How user.is_active controls account status
# - How form.cleaned_data gets validated data

File: authentication/forms.py

# STUDY THIS:
# - How to inherit from Django's UserCreationForm
# - How to customize form fields with widget attributes
# - How to add CSS classes via Python
# - Form validation methods

Then: Task Management

File: tasks/models.py

# STUDY THIS:
# - ForeignKey relationship (Task.user)
# - Model methods that return formatted data
# - Choices for status and priority
# - Meta class for model behavior

File: tasks/views.py

# STUDY THIS:
# - @login_required decorator
# - Task.objects.filter() - querying filtered data
# - get_object_or_404() - error handling
# - form.save() - saving to database
# - QuerySet methods: filter(), exclude(), order_by()

Finally: Frontend

File: templates/base.html

<!-- STUDY THIS: -->
<!-- {% load static %} - loading static files -->
<!-- {% block content %} - template inheritance -->
<!-- {% if user.is_authenticated %} - conditional rendering -->
<!-- {% url 'task_list' %} - URL reversal (dynamic URLs) -->
<!-- CSRF token in forms for security -->

File: static/css/style.css

/* STUDY THIS: */
/* :root variables for consistent colors */
/* @media queries for responsive design */
/* Gradient backgrounds and shadows */
/* CSS animations and transitions */
/* How Bootstrap classes work */

🧪 Hands-On Exercises

Exercise 1: Modify Task Fields

Goal: Add a new field to tasks (e.g., category)

Learn:

  1. Add field to tasks/models.py
  2. Create migration: python manage.py makemigrations
  3. Update form in tasks/forms.py
  4. Modify template in templates/tasks/task_form.html
  5. Update list template to display category

Exercise 2: Add Task Search

Goal: Search tasks by title

Learn:

  1. Understand QuerySet .filter(title__icontains=search_term)
  2. Pass search query from template to view
  3. Update tasks/views.py to filter on search
  4. Add search box to templates/tasks/task_list.html

Exercise 3: Create User Profile Page

Goal: Show user's task statistics

Learn:

  1. Create a profile view in authentication/views.py
  2. Query user's tasks: Task.objects.filter(user=request.user)
  3. Create templates/authentication/profile.html
  4. Calculate stats: count completed, pending, etc.

Exercise 4: Style Modifications

Goal: Change app's color scheme

Learn:

  1. Edit :root variables in static/css/style.css
  2. Understand color inheritance
  3. Add custom animations
  4. Create new component styles

🛠️ Key Technologies Explained

Django (Backend Framework)

  • Why: Handles database, user auth, routing, and templates automatically
  • File to Study: core/settings.py (the "brain" of the app)
  • Alternative: Flask (simpler but less batteries included)

Django ORM (Database Management)

  • Why: Write Python instead of SQL
  • File to Study: tasks/models.py
  • Concept: Models map to database tables, fields to columns

Bootstrap (CSS Framework)

  • Why: Pre-built responsive components
  • File to Study: All HTML templates
  • Alternative: Tailwind CSS (more customizable)

SQLite (Database)

  • Why: Perfect for development
  • File: db.sqlite3 (auto-created)
  • Production Alternative: PostgreSQL

🚀 Understanding the Request/Response Cycle

When you click "Create Task", here's what happens:

1. Browser sends POST request with form data
   ↓
2. Django matches URL in urls.py
   ↓
3. View function receives request
   ↓
4. Form validates data (forms.py)
   ↓
5. Model saves to database (models.py)
   ↓
6. Template renders response HTML
   ↓
7. Browser displays page to user

File to trace: tasks/views.pytask_create() function


💾 Database Understanding

How Django manages databases:

  1. Define Model (models.py) - What data structure looks like
  2. Create Migration (makemigrations) - Creates SQL instructions
  3. Apply Migration (migrate) - Executes SQL, creates tables
  4. Query Data (in views) - Get data using ORM

Your database file: db.sqlite3

  • Contains all user and task data
  • Deleted and recreated during development
  • Use manager.py to inspect: python manage.py shell

🔐 Security Concepts Learned

1. CSRF Protection

  • Where: CSRF token in every form
  • Why: Prevent unauthorized form submissions
  • File: See {% csrf_token %} in all forms

2. Password Hashing

  • How: Passwords stored as hashes, not plain text
  • File: authentication/forms.py uses UserCreationForm
  • Django handles: user.set_password() in the background

3. SQL Injection Prevention

  • How: ORM uses parameterized queries
  • File: tasks/views.py uses .filter() not raw SQL
  • Never do: Task.objects.raw("SELECT * WHERE id = " + str(id))

4. User Isolation

  • File: tasks/views.py - Every query filters by user=request.user
  • Why: Users can only see their own tasks

📊 What This App Teaches You

Concept File to Study Time to Learn
Models & Databases tasks/models.py 2-3 hours
Forms & Validation authentication/forms.py 2-3 hours
Views & Logic authentication/views.py 3-4 hours
URL Routing core/urls.py 1-2 hours
Templates templates/base.html 2-3 hours
CSS & Responsive Design static/css/style.css 3-4 hours
Django Admin tasks/admin.py 1 hour

Total Learning Time: ~15-20 hours to understand all concepts


🔧 Commands to Learn

# Create a new Django app
python manage.py startapp appname

# Create migration file
python manage.py makemigrations

# Apply migrations to database
python manage.py migrate

# Open Python shell with Django context
python manage.py shell

# Create superuser (admin account)
python manage.py createsuperuser

# Access admin panel
# Visit: http://127.0.0.1:8000/admin/

# Run tests
python manage.py test

# Format code
python manage.py format

# Check for issues
python manage.py check

📚 Next Steps to Level Up

After understanding this project:

  1. Build Similar Projects:

    • Note-taking app
    • Blog platform
    • Todo list with categories
    • Expense tracker
  2. Learn Advanced Topics:

    • Django REST Framework (building APIs)
    • Testing (unit tests, integration tests)
    • Authentication (social login, JWT tokens)
    • Deployment (Heroku, AWS, DigitalOcean)
  3. Explore Related Tech:

    • JavaScript/React (frontend frameworks)
    • PostgreSQL (production database)
    • Redis (caching)
    • Docker (containerization)

📖 Resources to Study


✅ Checklist for Understanding This Project

  • Read core/settings.py and understand what each setting does
  • Study authentication/models.py - understand User relationship
  • Study authentication/views.py - trace registration flow
  • Study authentication/forms.py - understand validation
  • Study tasks/models.py - understand Task model
  • Study tasks/views.py - trace create/update/delete flows
  • Read templates/base.html - understand template inheritance
  • Read templates/tasks/task_list.html - understand loops and conditionals
  • Study static/css/style.css - understand styling approach
  • Do at least 2 of the exercises above
  • Add one new feature on your own

🎓 Final Thoughts

This project teaches:

  • ✅ How web apps work (request/response)
  • ✅ How databases store data (models)
  • ✅ How servers process requests (views)
  • ✅ How browsers display pages (templates)
  • ✅ How to secure applications (auth, CSRF)
  • ✅ How to make responsive designs (CSS)

You now understand real-world web development!


Version: 2.0 (Educational Edition)
Last Updated: February 12, 2026
Next Goal: Deploy this app to the internet!

Features

✅ Authentication System

  • User Registration with email validation
  • Secure Login/Logout
  • Password Reset via Email
  • Email Confirmation System
  • User Profile Management

📋 Task Management

  • Create Tasks: Add new tasks with title, description, priority, and due dates
  • Edit Tasks: Modify existing tasks anytime
  • Delete Tasks: Remove completed or unwanted tasks
  • Task Status Tracking: Mark tasks as Pending, In Progress, or Completed
  • Priority Levels: Set Low, Medium, or High priority
  • Due Dates: Set deadlines for tasks
  • Task Statistics: View total, completed, pending, and high-priority task counts
  • Filter & Search: Filter by status and priority

🎨 User Interface

  • Professional, modern design
  • Responsive layout (mobile, tablet, desktop)
  • Beautiful color scheme with gradients
  • Font Awesome icons throughout
  • Bootstrap 5 components
  • Smooth animations and transitions

Project Structure

myapp/
├── core/                          # Django project settings
│   ├── settings.py               # Project configuration
│   ├── urls.py                   # URL routing
│   ├── wsgi.py                   # WSGI configuration
│   └── asgi.py                   # ASGI configuration
│
├── authentication/                # User authentication app
│   ├── models.py                 # User-related models
│   ├── views.py                  # Login, Register, Password Reset views
│   ├── forms.py                  # Authentication forms
│   ├── urls.py                   # Auth URLs
│   └── templates/                # Auth templates
│
├── tasks/                         # Task management app (NEW)
│   ├── models.py                 # Task model
│   ├── views.py                  # Task CRUD views
│   ├── forms.py                  # Task creation form
│   ├── urls.py                   # Task URLs
│   ├── admin.py                  # Django admin configuration
│   └── migrations/               # Database migrations
│
├── static/
│   └── css/
│       └── style.css             # Custom styling
│
├── templates/
│   ├── base.html                 # Base template with navbar/footer
│   ├── homepage.html             # Home page
│   ├── authentication/           # Auth templates
│   └── tasks/                    # Task templates (NEW)
│       ├── task_list.html        # Task dashboard
│       ├── task_form.html        # Create/Edit task form
│       └── task_confirm_delete.html
│
├── manage.py                      # Django management script
├── requirements.txt               # Python dependencies
└── db.sqlite3                     # SQLite database

Installation & Setup

Prerequisites

  • Python 3.8+
  • pip (Python package manager)
  • Virtual environment (recommended)

Step 1: Clone/Download the Project

cd "c:\Users\EB204_04\Desktop\Task Mgmt System\myapp"

Step 2: Create Virtual Environment (Optional but Recommended)

python -m venv venv
venv\Scripts\activate  # Windows
# or
source venv/bin/activate  # Mac/Linux

Step 3: Install Dependencies

pip install -r requirements.txt

Step 4: Apply Database Migrations

python manage.py migrate

Step 5: Create Superuser (Optional - for Admin Panel)

python manage.py createsuperuser
# Follow prompts to create admin account

Step 6: Collect Static Files

python manage.py collectstatic --noinput

Step 7: Run Development Server

python manage.py runserver

Step 8: Access the Application

Open your browser and go to:

http://127.0.0.1:8000/

Usage Guide

For New Users

  1. Visit Homepage: Go to http://127.0.0.1:8000/
  2. Register: Click "Get Started" or "Register"
  3. Fill Registration Form:
    • Username (unique, no spaces)
    • Email (for verification)
    • Password (8+ chars, with mix of letters/numbers/symbols)
    • Confirm Password
  4. Verify Email: Check email and click activation link
  5. Login: Use your credentials to log in
  6. Access Dashboard: Automatically redirected to task dashboard

For Existing Users

  1. Login: Go to http://127.0.0.1:8000/ → Click "Login"
  2. Dashboard: View task statistics and all your tasks
  3. Create Task: Click "Create Task" button
    • Enter title (required)
    • Add description (optional)
    • Set priority (Low/Medium/High)
    • Set status (Pending/In Progress/Completed)
    • Set due date (optional)
  4. Manage Tasks:
    • Edit: Click edit icon to modify task details
    • Delete: Click delete icon to remove task (confirmation required)
    • Mark as Complete: Click the circle icon to toggle status
    • Filter: Use status and priority dropdowns to filter tasks
  5. Logout: Click "Logout" in navbar

Task Status & Priority

Task Status

  • Pending: Task hasn't been started yet
  • In Progress: Currently working on the task
  • Completed: Task is finished

Task Priority

  • Low (Green): Non-urgent tasks
  • Medium (Yellow): Regular priority tasks
  • High (Red): Urgent, important tasks

Database Schema

Task Model

Task
├── user (ForeignKey to User) - Task owner
├── title (CharField) - Task title
├── description (TextField) - Detailed description
├── status (CharField) - Pending/In Progress/Completed
├── priority (CharField) - Low/Medium/High
├── due_date (DateField) - Optional deadline
├── created_at (DateTimeField) - Creation timestamp
└── updated_at (DateTimeField) - Last modification timestamp

Configuration

Email Settings

To enable password reset emails, add your email credentials to core/settings.py:

EMAIL_HOST_USER = 'your-email@gmail.com'
EMAIL_HOST_PASSWORD = 'your-app-password'  # Use App Password for Gmail

Update Site Name

Edit core/settings.py if needed:

DEFAULT_FROM_EMAIL = 'noreply@taskmanager.com'

Admin Panel

  1. Create a superuser: python manage.py createsuperuser
  2. Access admin panel: http://127.0.0.1:8000/admin/
  3. Manage tasks, users, and more

API Routes

Method URL Purpose
GET / Homepage
GET /register/ Register page
POST /register/ Submit registration
GET /login/ Login page
POST /login/ Submit login
GET /logout/ Logout
GET /tasks/ Task dashboard
GET /tasks/create/ Create task form
POST /tasks/create/ Submit new task
GET /tasks/<id>/update/ Edit task form
POST /tasks/<id>/update/ Submit task update
GET /tasks/<id>/delete/ Delete confirmation
POST /tasks/<id>/delete/ Submit deletion
POST /tasks/<id>/toggle/ Toggle task status

Troubleshooting

Problem: "No migrations to apply"

Solution: Run python manage.py makemigrations first

Problem: Static files not loading

Solution: Run python manage.py collectstatic --noinput

Problem: "Access Denied" errors

Solution:

  • Clear browser cache
  • Make sure you're logged in
  • Check user permissions

Problem: Email not sending

Solution:

  • Add email credentials to settings
  • For Gmail, use App Password (not regular password)
  • Enable "Less secure apps" if needed

Problem: Port 8000 already in use

Solution: Use different port: python manage.py runserver 8001

Technologies Used

  • Backend: Django 4.2.5
  • Frontend: Bootstrap 5, HTML5, CSS3
  • Database: SQLite3
  • Icons: Font Awesome 6
  • Fonts: Google Fonts (Poppins)

Requirements

See requirements.txt for full dependencies:

  • Django==4.2.5
  • asgiref==3.7.2
  • sqlparse==0.4.4
  • tzdata==2023.3

Security Features

  • ✅ CSRF Protection
  • ✅ SQL Injection Prevention
  • ✅ XSS Protection
  • ✅ Secure Password Hashing
  • ✅ User Authentication Required
  • ✅ Email Verification
  • ✅ Password Reset via Email

Performance

  • Optimized database queries
  • Efficient static file serving
  • Responsive design reduces bandwidth
  • Caching-ready architecture

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)
  • Mobile browsers (iOS Safari, Chrome Mobile)

Deployment Guidelines

For production deployment:

  1. Set DEBUG = False in settings.py
  2. Update ALLOWED_HOSTS with your domain
  3. Use a production database (PostgreSQL recommended)
  4. Set up proper email backend
  5. Use HTTPS
  6. Set up proper logging
  7. Use a production WSGI server (Gunicorn)

Future Enhancements

Potential features for future versions:

  • Task categories/tags
  • Recurring tasks
  • Task reminders/notifications
  • Task sharing/collaboration
  • Analytics dashboard
  • Dark mode
  • Mobile app
  • API for external integrations

Support & Issues

If you encounter issues:

  1. Check the console for error messages
  2. Verify all dependencies are installed
  3. Ensure database migrations are applied
  4. Check browser console (F12) for frontend errors
  5. Review Django logs in terminal

License

This project is provided as-is for educational purposes.

Credits

Built with Django, Bootstrap 5, and Font Awesome. Based on Django Authentication Starter template.


Quick Start Checklist

  • Install requirements: pip install -r requirements.txt
  • Run migrations: python manage.py migrate
  • Create superuser: python manage.py createsuperuser
  • Collect static: python manage.py collectstatic --noinput
  • Run server: python manage.py runserver
  • Visit: http://127.0.0.1:8000/
  • Register new user
  • Create first task
  • Test filtering and editing

Status: ✅ Ready for Production Submission

Last Updated: February 12, 2026

Version: 2.0 (Task Management Added) ├── urls.py └── views.py


Important files and directories in the authentication app:
- `forms.py`: This file contains the forms for UserRegistrationForm. UserRegistrationForm is a custom form that inherits from Django's built-in UserCreationForm.
- `urls.py`: This file contains the URL patterns for the authentication views.
- `views.py`: This file contains the views for user authentication features.

### The Core 

The core directory contains the project settings and URL configurations. The following is the directory structure of the core directory:

```bash
core
├── __init__.py
├── asgi.py
├── settings.py
├── urls.py
└── wsgi.py

Important files and directories inside the core directory:

  • settings.py: This file contains the project settings, including authentication settings.
  • urls.py: This file contains the URL patterns for the authentication views.

The Templates Directory

The templates directory contains the HTML templates for the authentication views. The following is the directory structure of the templates directory:

Note: The HTML contains skeleton code for the views. You can customize the HTML to suit your needs.

templates
├── authentication
│   ├── email_activation
│   │   ├── activate_email_message.html
│   │   ├── activation_successful.html
│   │   ├── activation_unsucessful.html
│   │   └── email_sent.html
│   ├── login.html
│   ├── password_reset.html
│   ├── password_reset_complete.html
│   ├── password_reset_confirm.html
│   ├── password_reset_done.html
│   └── register.html
└── homepage.html

Important files and directories inside the templates directory:

  • authentication/: This directory contains the HTML templates for the authentication views.
  • homepage.html: This file contains the HTML template for the homepage. This is where the user will be redirected after logging in.
  • authentication/login.html: This file contains the HTML template for the login view.
  • authentication/password_reset.html: This file contains the HTML template for the password reset view.
  • authentication/password_reset_complete.html: This file contains the HTML template for the password reset complete view when the password reset is successful
  • authentication/password_reset_confirm.html: This file contains the HTML template for the password reset confirm view when the user clicks the link in the email. This containes the form for the user to enter the new password.
  • authentication/password_reset_done.html: This file contains the HTML template for the password reset done view. This is the page that the user will be redirected to after the password reset is successful.
  • authentication/register.html: This file contains the HTML template for the user registration view.
  • authentication/email_activation/: This directory contains the HTML templates for the email activation views.
  • authentication/email_activation/activate_email_message.html: This file contains the HTML template for the email message sent to users for email activation.
  • authentication/email_activation/activation_successful.html: This file contains the HTML template for the email activation successful view.
  • authentication/email_activation/activation_unsuccessful.html: This file contains the HTML template for the email activation unsuccessful view.
  • authentication/email_activation/email_sent.html: This file contains the HTML template for the email sent view.

Getting Started

You can use this project as:

  1. Starter file for your own Django web applications
  2. Copy the authentication app into your existing Django project

As a Starter Project

To use this project as a starter project for your own Django web applications, follow these steps:

  1. Clone the repository:

    git clone https://github.com/johnmathewdino/init_auth_django.git
  2. Navigate to the project directory:

    cd init_auth_django
  3. Create a virtual environment and activate it:

    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
  4. Install project dependencies:

    pip install -r requirements.txt
  5. Set up the email backend (see instructions below).

  6. Apply database migrations:

    python manage.py migrate
  7. Create a superuser to access the Django admin panel:

    python manage.py createsuperuser
  8. Start the development server:

    python manage.py runserver
  9. Access the admin panel at http://localhost:8000/admin/ and log in with your superuser credentials.

Copy the Authentication App into existing Django Project

To copy the authentication app into your existing Django project, follow these steps:

  1. Copy the authentication directory into your Django project directory.
  2. Copy the templates directory into your Django project directory.
  3. Add authentication to the INSTALLED_APPS list in your project's settings.py file.
INSTALLED_APPS = [
    ...
    'authentication',
    ...
]
  1. Add the following to your project's settings.py file:
LOGIN_URL = "login"
LOGIN_REDIRECT_URL = "homepage"
LOGOUT_REDIRECT_URL = "login"
  1. Add the following to your project's urls.py file:
from django.urls import path, include

urlpatterns = [
    ...
    path('authentication/', include('authentication.urls')),
    ...
]

Setting up Email Backend

The Email Backend will let you send emails to users for email confirmation, password reset, etc. To set up the email backend, follow these steps:

To get email app password

  1. Go to https://myaccount.google.com/

  2. Click on Security

  3. Set up your 2-Step Verification

  4. Click on App Passwords

  5. Input an App Name and click on Create

  6. Copy the generated password

  7. Make sure you have to following in your settings.py file

    EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
    EMAIL_HOST = 'smtp.gmail.com'
    EMAIL_PORT = 587
    EMAIL_USE_TLS = True
    EMAIL_USE_SSL = False
    EMAIL_HOST_USER = ''
    EMAIL_HOST_PASSWORD = ''
  8. Replace EMAIL_HOST_USER with your email address

  9. Replace EMAIL_HOST_PASSWORD with the app password you generated

Contributing

Contributions to this project are welcome! Feel free to submit bug reports, feature requests, or pull requests.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors