Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,4 @@ queries
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.ruff_cache
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ repos:
rev: v0.11.10
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
119 changes: 109 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,113 @@
# pythonbooks

<<<<<<< HEAD
[![Ruff](https://github.com/khoshov/pythonbooks/actions/workflows/ruff.yml/badge.svg)](https://github.com/khoshov/pythonbooks/actions/workflows/ruff.yml)


## Установка и использование UV

##
- python -m pre_commit run --all-files
- pre-commit run --all-files
=======
##
pre-commit run --all-files
python -m pre_commit run --all-files
>>>>>>> c2e78f81458663ba5834fa5b4731ef2b58bd57be
<details>
<summary>📦 Способы установки UV</summary>

### 1. Установка через автономные установщики (рекомендуется)

**Для macOS и Linux:**
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

**Для Windows (PowerShell):**
```powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```

### 2. Установка через PyPI (альтернативный способ)
```bash
pip install uv
```

### Обновление UV
После установки вы можете обновить UV до последней версии:
```bash
uv self update
```

🔗 Подробнее об установке: [Официальная документация](https://docs.astral.sh/uv/getting-started/installation/)
</details>

---

<details>
<summary>🚀 Основные команды UV</summary>

### Управление Python-окружением

**Установка конкретной версии Python:**
```bash
uv python install 3.13 # Установит Python 3.13
```

### Управление зависимостями

**Синхронизация зависимостей проекта:**
```bash
uv sync # Аналог pip install + pip-compile
```

**Запуск команд в окружении проекта:**
```bash
uv run <COMMAND> # Например: uv run pytest
```

**Запуск Django-сервера:**
```bash
uv run manage.py runserver # Альтернатива python manage.py runserver
```
</details>

---

<details>
<summary>🔍 Интеграция с Ruff</summary>

[Ruff](https://github.com/astral-sh/ruff) - это молниеносный линтер для Python, также разработанный Astral.

**Установка Ruff через UV:**
```bash
uvx ruff # Установит последнюю версию Ruff
```

**Проверка кода с помощью Ruff:**
```bash
uvx ruff check . # Проверит все файлы в текущей директории
```
</details>

---

## Запуск проекта в Docker

**Сборка и запуск контейнеров:**
```bash
docker-compose up --build # Соберет и запустит сервисы
```

## Структура

```python

pythonbooks
├── .github/workflows
│ └── ruff.yml
├── apps
│ └── books
├── config
├── .gitignore
├── .pre-commit-config.yaml
├── manage.py
├── requirements.txt - зависимости
├── .env
└── README.md
```
File renamed without changes.
Empty file added apps/books/__init__.py
Empty file.
1 change: 1 addition & 0 deletions apps/books/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Register your models here.
6 changes: 6 additions & 0 deletions apps/books/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class BooksConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.books"
Empty file.
1 change: 1 addition & 0 deletions apps/books/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Create your models here.
1 change: 1 addition & 0 deletions apps/books/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Create your tests here.
1 change: 1 addition & 0 deletions apps/books/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Create your views here.
16 changes: 0 additions & 16 deletions backend/pythonbooks/pythonbooks/asgi.py

This file was deleted.

23 changes: 0 additions & 23 deletions backend/pythonbooks/pythonbooks/urls.py

This file was deleted.

16 changes: 0 additions & 16 deletions backend/pythonbooks/pythonbooks/wsgi.py

This file was deleted.

Empty file added config/__init__.py
Empty file.
7 changes: 7 additions & 0 deletions config/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os

from django.core.asgi import get_asgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

application = get_asgi_application()
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"apps.books.apps.BooksConfig",
]

MIDDLEWARE = [
Expand All @@ -49,7 +50,7 @@
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = "pythonbooks.urls"
ROOT_URLCONF = "config.urls"

TEMPLATES = [
{
Expand All @@ -66,7 +67,7 @@
},
]

WSGI_APPLICATION = "pythonbooks.wsgi.application"
WSGI_APPLICATION = "config.wsgi.application"


# Database
Expand Down Expand Up @@ -101,13 +102,13 @@

# Internationalization
# https://docs.djangoproject.com/en/5.2/topics/i18n/

LANGUAGE_CODE = "en-us"

LANGUAGE_CODE = "en"
LANGUAGES = [
("en", "English"),
("ru", "Russian"),
]
TIME_ZONE = "UTC"

USE_I18N = True

USE_TZ = True


Expand Down
6 changes: 6 additions & 0 deletions config/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.contrib import admin
from django.urls import path

urlpatterns = [
path("admin/", admin.site.urls),
]
7 changes: 7 additions & 0 deletions config/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

application = get_wsgi_application()
5 changes: 1 addition & 4 deletions backend/pythonbooks/manage.py → manage.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""

import os
import sys


def main():
"""Run administrative tasks."""
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pythonbooks.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down