readme fix
This commit is contained in:
@@ -1,53 +1,53 @@
|
||||
# sqlalchemy-fastapi-pydentic-pytest
|
||||
|
||||
Pet-проект на стеке **FastAPI + SQLAlchemy (async) + Pydantic + Pytest**.
|
||||
Реализован CRUD для пользователей, JWT-аутентификация и тесты.
|
||||
Pet project built with **FastAPI + SQLAlchemy (async) + Pydantic + Pytest**.
|
||||
Implements CRUD for users, JWT authentication, and tests.
|
||||
|
||||
---
|
||||
|
||||
## 📂 Структура проекта
|
||||
## 📂 Project Structure
|
||||
```
|
||||
/
|
||||
├── server/backend # Исходный код: endpoints, pydantic, JWT, отправка паролей на почту, permissions, rate-limiting
|
||||
├── server/frontend # Странички login, registration, reset-password, main
|
||||
├── server/database # База данных, alembic, db_balancer(не настроен, как шаблон)
|
||||
├── server/backend # Source code: endpoints, pydantic, JWT, password email sending, permissions, rate-limiting
|
||||
├── server/frontend # Pages: login, registration, reset-password, main
|
||||
├── server/database # Database, alembic, db_balancer (not configured, template only)
|
||||
├── server/testing # pytests
|
||||
├── run.py # Точка входа, запуск приложения
|
||||
├── makefile # Точка входа, запуск приложения и утилит
|
||||
├── requirements.txt # Зависимости
|
||||
├── .env # Переменные окружения
|
||||
└── README.md # Этот файл
|
||||
├── run.py # Entry point, application startup
|
||||
├── makefile # Entry point, application and utility commands
|
||||
├── requirements.txt # Dependencies
|
||||
├── .env # Environment variables
|
||||
└── README.md # This file
|
||||
|
||||
```
|
||||
---
|
||||
|
||||
## ⚙️ Требования
|
||||
## ⚙️ Requirements
|
||||
|
||||
- Python 3.13.3
|
||||
- SQLite (по умолчанию)
|
||||
- SQLite (default)
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Установка и запуск
|
||||
## 🚀 Installation and Running
|
||||
|
||||
1. Клонировать репозиторий:
|
||||
1. Clone the repository:
|
||||
```bash
|
||||
git clone <URL репозитория>
|
||||
git clone <repository URL>
|
||||
cd sqlalchemy-fastapi-pydentic-pytest
|
||||
```
|
||||
2. Создать и активировать виртуальное окружение:
|
||||
2. Create and activate a virtual environment:
|
||||
```
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate # Linux / macOS
|
||||
venv\Scripts\activate # Windows
|
||||
```
|
||||
|
||||
3. Установить зависимости:
|
||||
3. Install dependencies:
|
||||
```
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
4. Настроить .env файл (пример):
|
||||
4. Configure the .env file (example):
|
||||
```
|
||||
ALLOW_ORIGINS=http://localhost:3000
|
||||
ALLOW_CREDENTIALS=true
|
||||
@@ -56,30 +56,30 @@ ALLOW_HEADERS=*
|
||||
JWT_SECRET_KEY=your_secret_key
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES=30
|
||||
```
|
||||
5. Мигрировать БД:
|
||||
5. Run DB migrations:
|
||||
```
|
||||
make migrate_head
|
||||
```
|
||||
6. Запустить приложение:
|
||||
6. Start the application:
|
||||
```
|
||||
python run.py или вне окружения сразу прописать make run
|
||||
Открыть страничку через microsoft live server
|
||||
python run.py, or without the environment, simply run make run
|
||||
Open the page via Microsoft Live Server
|
||||
```
|
||||
|
||||
7. Документация OpenAPI будет доступна по адресу:
|
||||
7. OpenAPI documentation will be available at:
|
||||
```
|
||||
• Swagger UI → http://localhost:8000/docs
|
||||
• JSON схема → http://localhost:8000/openapi.json
|
||||
• JSON schema → http://localhost:8000/openapi.json
|
||||
```
|
||||
⸻
|
||||
|
||||
🔐 Аутентификация
|
||||
• Эндпоинт /login принимает application/x-www-form-urlencoded:
|
||||
🔐 Authentication
|
||||
• The /login endpoint accepts application/x-www-form-urlencoded:
|
||||
```
|
||||
username=<email>&password=<пароль>
|
||||
username=<email>&password=<password>
|
||||
```
|
||||
|
||||
Возвращает JWT токен:
|
||||
Returns a JWT token:
|
||||
```
|
||||
{
|
||||
"access_token": "...",
|
||||
@@ -88,31 +88,31 @@ username=<email>&password=<пароль>
|
||||
```
|
||||
⸻
|
||||
```
|
||||
👤 Пользователи (CRUD)
|
||||
• POST /user_create — создать пользователя
|
||||
• GET /get_user_by_email/{email} — получить пользователя по email
|
||||
• GET / — получить всех пользователей
|
||||
• PUT /user_update/{email} — обновить данные пользователя
|
||||
• DELETE /user_delete/{email} — удалить пользователя
|
||||
👤 Users (CRUD)
|
||||
• POST /user_create — create a user
|
||||
• GET /get_user_by_email/{email} — get a user by email
|
||||
• GET / — get all users
|
||||
• PUT /user_update/{email} — update user data
|
||||
• DELETE /user_delete/{email} — delete a user
|
||||
```
|
||||
⸻
|
||||
|
||||
🧪 Тестирование
|
||||
🧪 Testing
|
||||
|
||||
Запуск всех тестов:
|
||||
Run all tests:
|
||||
```
|
||||
make test
|
||||
```
|
||||
Тестируются (В планах):
|
||||
Test coverage (planned):
|
||||
```
|
||||
• CRUD операции
|
||||
• Pydantic-схемы
|
||||
• Эндпоинты API
|
||||
• JWT авторизация
|
||||
• Тестирование
|
||||
• CRUD operations
|
||||
• Pydantic schemas
|
||||
• API endpoints
|
||||
• JWT authorization
|
||||
• Testing
|
||||
```
|
||||
⸻
|
||||
|
||||
📜 Лицензия
|
||||
📜 License
|
||||
|
||||
Учебный проект.
|
||||
Educational project.
|
||||
Reference in New Issue
Block a user