Setup and Deployment Guide
- Python 3.9+
- pip
- virtualenv (recommended)
- Google Cloud account for OAuth
git clone https://github.com/Abhayaj247/task_manager.git
cd task_manager
# On Windows
python -m venv venv
venv\Scripts\activate
# On macOS/Linux
python3 -m venv venv
source venv/bin/activate
Create a file named .env
in the project root with the following structure:
# Django Settings
DJANGO_SECRET_KEY=your_very_long_random_secret_key
DJANGO_DEBUG=True
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1
# Google OAuth Credentials
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# Email Settings (Optional)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_HOST_USER=[email protected]
EMAIL_HOST_PASSWORD=your_email_app_password
EMAIL_USE_TLS=True
python -c "import secrets; print(secrets.token_urlsafe(50))"
pip install -r requirements.txt
Create or update .gitignore
in the project root:
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
# Virtual Environment
venv/
env/
.env/
.venv/
# Django
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Sensitive Files
.env
*.env
!.env.example
# IDE and Editor Files
.vscode/
.idea/
*.swp
*.swo
*~
# OS Generated Files
.DS_Store
Thumbs.db
Create a template .env.example
with dummy/placeholder values:
# Django Settings
DJANGO_SECRET_KEY=change_this_to_your_secret_key
DJANGO_DEBUG=False
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1
# Google OAuth Credentials
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# Email Settings
EMAIL_HOST=smtp.example.com
EMAIL_PORT=587
EMAIL_HOST_USER=[email protected]
EMAIL_HOST_PASSWORD=your_email_app_password
EMAIL_USE_TLS=True
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
- Go to Google Cloud Console (https://console.cloud.google.com/)
- Create a new project
- Navigate to "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- Select "Web application"
- Add authorized JavaScript origins and redirect URIs:
- Run the server:
python manage.py runserver
- Go to admin panel (http://localhost:8000/admin/)
- Add a Site:
- Domain name: localhost:8000
- Display name: Local Development
- Add a Social Application:
- Provider: Google
- Name: Google OAuth
- Client ID: [from Google Cloud Console]
- Secret Key: [from Google Cloud Console]
- Chosen sites: Select your local site
python manage.py runserver
- Set
DEBUG=False
in production - Use a production-grade database (PostgreSQL recommended)
- Use environment-specific settings
- Set strong, unique
SECRET_KEY
- Configure proper logging
- Use HTTPS
- Set up proper email backend
pip install gunicorn psycopg2-binary dj-database-url
- Verify all dependencies are installed
- Check environment variables
- Ensure correct Python and Django versions
- Verify Google OAuth configuration
- Check Django debug logs
- Use
python manage.py check --deploy
for deployment checks
- Regularly update dependencies
- Rotate secret keys
- Use strong, unique passwords
- Enable two-factor authentication
- Limit admin access
- Fork the repository
- Create a feature branch
- Commit changes
- Push to the branch
- Create a Pull Request
[Specify your project license]