1. Home
  2. Employee মনিটরিং
  3. বেসিক
  4. 🗃️ 🔖 Part 1: Django Project Setup

🗃️ 🔖 Part 1: Django Project Setup

নিচে 🗃️ 🔖 Part 1: Django Project Setup এর প্রফেশনাল লেভেলের বাস্তব টিউটোরিয়াল দিলাম, যাতে তুমি production-grade project confidently build করতে পারো। এখানে প্রতিটি স্টেপে Bangla comments + explanation রয়েছে।


🗃️ 🔖 Part 1: Django Project Setup


১. Creating a new Django project: employee_monitoring

🔨 Step 1.1 – Create Project Directory

# কোমপানির বা লাযেন এর নাম অনুযায ফোলডার বানাও
mkdir employee_monitoring_system
cd employee_monitoring_system

🔨 Step 1.2 – Create Virtual Environment (Recommended: virtualenv)

# Virtualenv install না থাকলে
pip install virtualenv

# নতুন virtualenv তৈরি করো
virtualenv venv

# Virtualenv activate করো (Windows)
venv\Scripts\activate

# Linux/macOS হলে
# source venv/bin/activate

🔎 Why virtualenv?
Python এর package গুলো isolate থাকে। সিস্টেম লেভেল পাইথন নষ্ট হবে না।


🔨 Step 1.3 – Install Django & Django REST Framework

pip install django djangorestframework psycopg2-binary
  • django → Core web framework
  • djangorestframework → API development
  • psycopg2-binary → PostgreSQL integration

🔨 Step 1.4 – Start Django Project

django-admin startproject employee_monitoring .

🔎 Note: শেষের . মানে current directory তে project initialize হবে।


🔨 Step 1.5 – Run First Server Test

python manage.py runserver

✔️ ব্রাউজারে গিয়ে দেখো http://127.0.0.1:8000


২. Settings.py optimization for production

🔨 Step 2.1 – Open employee_monitoring/settings.py

⚠️ Production settings checklist

DEBUG = False (production এ)

ALLOWED_HOSTS

DEBUG = False

ALLOWED_HOSTS = ['your_domain.com', 'server_ip']

Secret Key Security

# .env file বা server environment variable থেকে load করবে future setup 
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')

Database config (PostgreSQL)

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'employee_monitoring_db',
        'USER': 'db_user',
        'PASSWORD': 'db_password',
        'HOST': 'localhost',
        'PORT': '5432',
    }
}

🔎 Why PostgreSQL?

  • Production ready
  • Better JSONField support
  • Advanced indexing & performance

Static & Media files settings

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')

৩. Creating the monitoring app

🔨 Step 3.1 – Start App

python manage.py startapp monitoring

🔨 Step 3.2 – Register app in settings.py

INSTALLED_APPS = [
    ...
    'rest_framework',
    'monitoring',
]

৪. Project structure & scalable folder architecture

🎯 Final Project Tree (after Part 1)

employee_monitoring_system/
├── employee_monitoring/
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   ├── wsgi.py
│   └── asgi.py
├── monitoring/
│   ├── migrations/
│   ├── __init__.py
│   ├── admin.py
│   ├── apps.py
│   ├── models.py
│   ├── serializers.py      # ✅ DRF serializers
│   ├── views.py
│   ├── urls.py             # ✅ app level urls
│   └── tests.py
├── media/
├── static/
├── manage.py
├── venv/
└── requirements.txt

🔨 Step 4.1 – Create serializers.py & urls.py in monitoring app

# These files are standard in professional DRF apps for modularity
touch monitoring/serializers.py
touch monitoring/urls.py

🔨 Step 4.2 – Freeze requirements

pip freeze > requirements.txt

🔎 Why?
Deployment server এ exact version install করার জন্য।


📝 Bangla Explanation Summary

✔️ আমরা Django project ও monitoring app initialize করেছি
✔️ PostgreSQL database integration setup করেছি, যা future scaling এ খুবই গুরুত্বপূর্ণ।
✔️ Production security best practices (ALLOWED_HOSTS, SECRET_KEY management) implement করেছি।
✔️ Project কে modular scalable architecture তে setup করেছি যাতে future enterprise features (multi company SaaS, advanced API) integrate করা যায়।


🚀 ➡️ Next Step:

🔖 Part 2: Employee Management Module

  1. Employee model design
  2. Migration & database setup
  3. Django admin customization
  4. Employee CRUD views (if needed for API testing)

How can we help?