Files
NeveTimePanel/ИСПРАВЛЕНИЕ_ОШИБКИ.md
2026-01-15 09:32:13 +06:00

105 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ✅ Исправление ошибки ModuleNotFoundError
## ❌ Ошибка
```
ModuleNotFoundError: No module named 'authlib.integrations.fastapi_client'
```
## ✅ Решение
### Шаг 1: Установите зависимости
```bash
cd backend
pip install authlib==1.3.0 httpx==0.26.0
```
Или установите все зависимости сразу:
```bash
cd backend
pip install -r requirements.txt
```
### Шаг 2: Проверьте установку
```bash
python -c "from authlib.integrations.starlette_client import OAuth; print('✓ OK')"
```
Должно вывести: `✓ OK`
### Шаг 3: Запустите сервер
```bash
cd backend
python main.py
```
Должно появиться:
```
⚠ ZITADEL провайдер не настроен. Проверьте .env файл.
INFO: Started server process [12345]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8000
```
## 📝 Что было исправлено
### В файле `backend/main.py`
**Было:**
```python
from authlib.integrations.fastapi_client import OAuth
```
**Стало:**
```python
from authlib.integrations.starlette_client import OAuth
```
**Причина:** FastAPI основан на Starlette, поэтому в authlib 1.3.0 используется `starlette_client`, а не `fastapi_client`.
## 🔍 Проверка
### 1. Проверьте версию authlib
```bash
pip show authlib
```
Должно быть: `Version: 1.3.0`
### 2. Проверьте импорт
```bash
python -c "from authlib.integrations.starlette_client import OAuth; print('✓ Импорт работает')"
```
### 3. Проверьте main.py
```bash
python -c "import py_compile; py_compile.compile('backend/main.py', doraise=True); print('✓ Синтаксис правильный')"
```
## ✅ Готово!
Ошибка исправлена. Теперь можете запускать сервер:
```bash
cd backend
python main.py
```
## 🚀 Следующие шаги
1. Настройте ZITADEL (см. `ZITADEL_QUICK_START.md`)
2. Обновите `.env` файл
3. Перезапустите сервер
4. Проверьте кнопку "Войти через ZITADEL"
## 📚 Дополнительная информация
- **Документация authlib:** https://docs.authlib.org/
- **FastAPI и Starlette:** https://fastapi.tiangolo.com/
- **Наша документация:** `README_OIDC.md`