Skip to content

Enhance environment configuration: .env.template + env-aware manage.py support#54

Closed
rajnil9 wants to merge 3 commits intoAvishkarPatil:mainfrom
rajnil9:main
Closed

Enhance environment configuration: .env.template + env-aware manage.py support#54
rajnil9 wants to merge 3 commits intoAvishkarPatil:mainfrom
rajnil9:main

Conversation

@rajnil9
Copy link

@rajnil9 rajnil9 commented Aug 30, 2025

📝 Description

This PR updates manage.py to support loading environment variables via .env and dynamically selecting Django settings based on the ENV variable (development or production). It also introduces logging for clearer debugging.

Additionally, a bug was fixed in the name == "main" check which previously prevented execution.

🔗 Related Issue

Fixes #52

🔄 Type of Change

✨ New feature (non-breaking change which adds functionality)
🐛 Bug fix (non-breaking change which fixes an issue)

🧪 Testing

-Verified .env variables are loaded correctly
-Tested switching between development and production settings
-Confirmed script runs without import errors

  • No new warnings introduced

📱 Frontend Changes (if applicable)

Verified .env variables are loaded correctly
Tested switching between development and production settings
Confirmed script runs without import errors
No new warnings introduced

🔧 Backend Changes (if applicable)

Settings module now selected dynamically based on ENV
Logging added for import errors and active settings module

@github-actions
Copy link

Thanks for creating a PR for your Issue! ☺️

We'll review it as soon as possible.
In the meantime, please double-check the file changes and ensure that all commits are accurate.

If there are any unresolved review comments, feel free to resolve them. 🙌🏼

@rajnil9
Copy link
Author

rajnil9 commented Aug 30, 2025

Hey @AvishkarPatil please merge this . Thank you .

@rajnil9
Copy link
Author

rajnil9 commented Aug 30, 2025

📝 Description

This PR introduces a structured .env.template file to simplify environment setup for contributors and improve project security. It provides clear documentation, safe defaults, and optional configurations for services.

Isssue : #51

Key highlights:

Added .env.template with variables for Django, Database, JWT, AI integration, Email, CORS, Security, and Logging
Included inline documentation and best practices (never commit real secrets)
Provided defaults for local development (Postgres/SQLite)
Commented out optional services (Redis, Celery, Email) for clarity
Improved contributor onboarding by standardizing config management

🔄 Type of Change

New feature (non-breaking change which adds functionality)
Documentation update

🔧 Backend Changes

Environment configuration now uses .env.template
Secure defaults for production and development separated

@rajnil9
Copy link
Author

rajnil9 commented Aug 30, 2025

Hey @AvishkarPatil I have PRed issue no. #52 and #51 , please merge them . Thank you

@rajnil9 rajnil9 changed the title Enhance manage.py with .env support and environment-based settings Enhance environment configuration: .env.template + env-aware manage.py support Aug 30, 2025
@AvishkarPatil
Copy link
Owner

@rajnil9 Thanks for the configuration improvements! The .env.example is excellent. 👍

✅ Good work:

  • Comprehensive .env.example with all needed variables
  • Good organization and security warnings

🚨 Critical Issue:

  • Syntax error in manage.py line 32: _name_ should be __name__

⚠️ Concerns:

  • manage.py is over-engineered for current project needs
  • Requires new dependency (python-dotenv)
  • Complex environment switching may cause issues

Please fix the syntax error before merging.

@AvishkarPatil AvishkarPatil self-requested a review August 30, 2025 08:02
Copy link
Owner

@AvishkarPatil AvishkarPatil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes needed as per mentioned

@rajnil9
Copy link
Author

rajnil9 commented Aug 30, 2025

Hey @AvishkarPatil check now i have removed the complexities and fixed the syntax errors

@AvishkarPatil
Copy link
Owner

Hi @rajnil9,
According to your PR history, it looks like the initial changes you made were reverted in a later commit, so there are currently no actual changes in this PR. Because of this, it doesn't make sense to merge it.
Please let me know if I misunderstood anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor manage.py with Environment Support & Logging

2 participants