refactor(db): update cursor rules and enhance deployment rollback script

- Standardized string formatting in cursor rules for consistency.
- Added a new rollback deployment script to facilitate blue-green deployment strategy.
- Removed outdated seed data files and introduced new rarity mappings for better data management.
- Improved model relationships and query optimizations in various views and admin configurations.
- Enhanced caching strategies across templates to improve performance and reduce load times, including jitter in cache settings for better performance.
- Refactored card-related views and templates to utilize new model fields and relationships.
This commit is contained in:
badblocks 2025-06-19 15:42:36 -07:00
parent 39a002e394
commit af2f48a491
No known key found for this signature in database
37 changed files with 2444 additions and 13565 deletions

View file

@ -10,9 +10,9 @@ Key Principles
Django/Python
- Use Djangos class-based views (CBVs) for more complex views; prefer function-based views (FBVs) for simpler logic.
- Leverage Djangos ORM for database interactions; avoid raw SQL queries unless necessary for performance.
- Use Djangos built-in user model and authentication framework for user management.
- Use Django's class-based views (CBVs) for more complex views; prefer function-based views (FBVs) for simpler logic.
- Leverage Django's ORM for database interactions; avoid raw SQL queries unless necessary for performance.
- Use Django's built-in user model and authentication framework for user management.
- Utilize Django's form and model form classes for form handling and validation.
- Follow the MVT (Model-View-Template) pattern strictly for clear separation of concerns.
- Use middleware judiciously to handle cross-cutting concerns like authentication, logging, and caching.
@ -25,20 +25,29 @@ Error Handling and Validation
- Customize error pages (e.g., 404, 500) to improve user experience and provide helpful information.
- Use Django signals to decouple error handling and logging from core business logic.
Development, Testing, and Operations
- Use Gatus for service health monitoring and status pages.
- Employ Locust for load testing to ensure application scalability and performance under stress.
- Utilize Playwright for end-to-end testing to simulate user interactions and validate application behavior from the user's perspective.
Dependencies
- Django
- Django REST Framework (for API development)
- Celery (for background tasks)
- Redis (for caching and task queues)
- PostgreSQL or MySQL (preferred databases for production)
- Granian / Gunicorn (for serving the application)
- Whitenoise (for serving static files)
- Tailwind CSS for the frontend
- Django Crispy Forms for the frontend
- Django Allauth for authentication
- Django DaisyUI for the frontend
- Django El Pagination for the frontend
- Django Crispy Forms for the frontend
- Crispy Tailwind for Tailwind-compatible Crispy Forms
- Django DaisyUI for the admin frontend
- Django Widget Tweaks for the frontend
- Django Crispy Tailwind for the frontend
- django-debug-toolbar for debugging
- django-health-check for application health monitoring
- django-parler for multilingual support
Django-Specific Guidelines
@ -46,17 +55,17 @@ Django-Specific Guidelines
- Keep business logic in models and forms; keep views light and focused on request handling.
- Use Django's URL dispatcher (urls.py) to define clear and RESTful URL patterns.
- Apply Django's security best practices (e.g., CSRF protection, SQL injection protection, XSS prevention).
- Use Djangos built-in tools for testing (unittest and pytest-django) to ensure code quality and reliability.
- Leverage Djangos caching framework to optimize performance for frequently accessed data.
- Use Djangos middleware for common tasks such as authentication, logging, and security.
- Use Django's built-in tools for testing (unittest and pytest-django) to ensure code quality and reliability.
- Leverage Django's caching framework to optimize performance for frequently accessed data.
- Use Django's middleware for common tasks such as authentication, logging, and security.
Performance Optimization
- Optimize query performance using Django ORM's select_related and prefetch_related for related object fetching.
- Use Djangos cache framework with backend support (e.g., Redis or Memcached) to reduce database load.
- Use Django's cache framework with backend support (e.g., Redis or Memcached) to reduce database load.
- Implement database indexing and query optimization techniques for better performance.
- Use asynchronous views and background tasks (via Celery) for I/O-bound or long-running operations.
- Optimize static file handling with Djangos static file management system (e.g., WhiteNoise or CDN integration).
- Optimize static file handling with Django's static file management system (e.g., WhiteNoise or CDN integration).
Key Conventions