mirror of
https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
synced 2026-11-30 14:52:55 +08:00
rename folder
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
---
|
||||
description: Guidelines for Django forms, focusing on form handling, validation, and model form usage.
|
||||
globs: **/forms.py
|
||||
---
|
||||
- Utilize Django's form and model form classes for form handling and validation.
|
||||
- Use Django's validation framework to validate form and model data.
|
||||
- Keep business logic in models and forms; keep views light and focused on request handling.
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
description: Guidance on using Django middleware for cross-cutting concerns like authentication, logging, and caching.
|
||||
globs: **/middleware.py
|
||||
---
|
||||
- Use middleware judiciously to handle cross-cutting concerns like authentication, logging, and caching.
|
||||
- Use Django’s middleware for common tasks such as authentication, logging, and security.
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
description: Rules for Django models, emphasizing ORM usage, database interactions, and data validation.
|
||||
globs: **/models.py
|
||||
---
|
||||
- Leverage Django’s ORM for database interactions; avoid raw SQL queries unless necessary for performance.
|
||||
- Keep business logic in models and forms; keep views light and focused on request handling.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
description: Rules for Django REST Framework serializers, focusing on JSON responses.
|
||||
globs: **/serializers.py
|
||||
---
|
||||
- Use Django templates for rendering HTML and DRF serializers for JSON responses.
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
description: Configurations for Django settings file with the list of dependencies and conventions.
|
||||
globs: **/settings.py
|
||||
---
|
||||
- Django
|
||||
- Django REST Framework (for API development)
|
||||
- Celery (for background tasks)
|
||||
- Redis (for caching and task queues)
|
||||
- PostgreSQL or MySQL (preferred databases for production)
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
description: Rules for Django templates, focusing on rendering HTML and following best practices.
|
||||
globs: **/templates/**/*.html
|
||||
---
|
||||
- Use Django templates for rendering HTML and DRF serializers for JSON responses.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
description: Guidelines for Django URL configurations, focusing on clear and RESTful URL patterns.
|
||||
globs: **/urls.py
|
||||
---
|
||||
- Use Django’s URL dispatcher (urls.py) to define clear and RESTful URL patterns.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
description: Specific guidelines for Django views, focusing on class-based vs. function-based views, error handling, and request handling.
|
||||
globs: **/views.py
|
||||
---
|
||||
- Use Django’s class-based views (CBVs) for more complex views; prefer function-based views (FBVs) for simpler logic.
|
||||
- Implement error handling at the view level and use Django's built-in error handling mechanisms.
|
||||
- Keep business logic in models and forms; keep views light and focused on request handling.
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
---
|
||||
description: Focus on performance optimization techniques in all files of the project.
|
||||
globs: **/*.*
|
||||
---
|
||||
- Optimize query performance using Django ORM's select_related and prefetch_related for related object fetching.
|
||||
- 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 Django’s static file management system (e.g., WhiteNoise or CDN integration).
|
||||
- Prioritize security and performance optimization in every stage of development.
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
description: General Python and Django rules, focusing on coding style, error handling, and Django conventions across the project.
|
||||
globs: **/*.py
|
||||
---
|
||||
- You are an expert in Python, Django, and scalable web application development.
|
||||
- Write clear, technical responses with precise Django examples.
|
||||
- Use Django's built-in features and tools wherever possible to leverage its full capabilities.
|
||||
- Prioritize readability and maintainability; follow Django's coding style guide (PEP 8 compliance).
|
||||
- Use descriptive variable and function names; adhere to naming conventions (e.g., lowercase with underscores for functions and variables).
|
||||
- Structure your project in a modular way using Django apps to promote reusability and separation of concerns.
|
||||
- Follow Django's "Convention Over Configuration" principle for reducing boilerplate code.
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
description: Apply security best practices across all files in the Django project.
|
||||
globs: **/*.*
|
||||
---
|
||||
- Apply Django's security best practices (e.g., CSRF protection, SQL injection protection, XSS prevention).
|
||||
- Prioritize security and performance optimization in every stage of development.
|
||||
Reference in New Issue
Block a user