# django.core.exceptions.ImproperlyConfigured: URL模式'myapp/'没有尾斜杠。

- **ID:** `python/django-redirect-without-trailing-slash`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

URL模式未定义尾斜杠，但Django的APPEND_SLASH设置期望有斜杠。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Ensure all URL patterns end with a slash: path('myapp/', views.my_view).
   ```
2. **** (90% 成功率)
   ```
   Use re_path with regex that allows optional trailing slash.
   ```

## 无效尝试

- **** — Disables automatic slash appending, may break expected URL behavior and cause 404s. (70% 失败率)
- **** — Complex and unnecessary; best to define URLs consistently with slashes. (60% 失败率)
