mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 11:51:10 -05:00
- Add complete backend/ directory with full Django application - Add frontend/ directory with Vite + TypeScript setup ready for Next.js - Add comprehensive shared/ directory with: - Complete documentation and memory-bank archives - Media files and avatars (letters, park/ride images) - Deployment scripts and automation tools - Shared types and utilities - Add architecture/ directory with migration guides - Configure pnpm workspace for monorepo development - Update .gitignore to exclude .django_tailwind_cli/ build artifacts - Preserve all historical documentation in shared/docs/memory-bank/ - Set up proper structure for full-stack development with shared resources
66 lines
2.1 KiB
Python
Executable File
66 lines
2.1 KiB
Python
Executable File
#!/usr/bin/env python
|
|
"""Django's command-line utility for administrative tasks."""
|
|
import os
|
|
import sys
|
|
|
|
|
|
def main():
|
|
"""Run administrative tasks."""
|
|
# Auto-detect environment based on command line arguments and environment variables
|
|
settings_module = detect_settings_module()
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings_module)
|
|
|
|
try:
|
|
from django.core.management import execute_from_command_line
|
|
except ImportError as exc:
|
|
print(
|
|
"Error: Couldn't import Django. Make sure Django is installed and "
|
|
"available on your PYTHONPATH environment variable. "
|
|
"Did you forget to activate a virtual environment?"
|
|
)
|
|
print("\nTo set up your development environment, try:")
|
|
print(" python manage.py setup_dev")
|
|
raise ImportError(
|
|
"Couldn't import Django. Are you sure it's installed and "
|
|
"available on your PYTHONPATH environment variable? Did you "
|
|
"forget to activate a virtual environment?"
|
|
) from exc
|
|
|
|
execute_from_command_line(sys.argv)
|
|
|
|
|
|
def detect_settings_module():
|
|
"""Auto-detect the appropriate settings module based on context."""
|
|
# Check if DJANGO_SETTINGS_MODULE is already set
|
|
if "DJANGO_SETTINGS_MODULE" in os.environ:
|
|
return os.environ["DJANGO_SETTINGS_MODULE"]
|
|
|
|
# Test environment detection
|
|
if "test" in sys.argv:
|
|
if "accounts" in sys.argv:
|
|
return "config.django.test_accounts"
|
|
return "config.django.test"
|
|
|
|
# Check for production indicators
|
|
production_indicators = [
|
|
"DYNO", # Heroku
|
|
"AWS_EXECUTION_ENV", # AWS Lambda
|
|
"KUBERNETES_SERVICE_HOST", # Kubernetes
|
|
"DOCKER_CONTAINER", # Docker
|
|
]
|
|
|
|
if any(indicator in os.environ for indicator in production_indicators):
|
|
return "config.django.production"
|
|
|
|
# Check DEBUG environment variable
|
|
debug = os.environ.get("DEBUG", "").lower()
|
|
if debug in ("false", "0", "no"):
|
|
return "config.django.production"
|
|
|
|
# Default to local development
|
|
return "config.django.local"
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|