-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into feature/db-test-data
- Loading branch information
Showing
5 changed files
with
115 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,68 @@ | ||
# backend | ||
|
||
## Схема базы данных | ||
Обновление картинки после изменения dbml с помощью команды: | ||
``` | ||
npx --package=@softwaretechnik/dbml-renderer -- dbml-renderer -i docs/db.dbml -o docs/db.svg | ||
``` | ||
|
||
Схему БД в интерактивном режиме можно посмотреть по ссылке: | ||
|
||
[СХЕМА БД](https://dbdiagram.io/d/64bb081202bd1c4a5e7f8c0b) | ||
|
||
|
||
## Документация API | ||
В проекте реализована автоматическая генерация документации. Документация доступна по адресам: | ||
1) Swagger: `/api/v1/schema/swagger-ui/` | ||
2) Redoc: `/api/v1/schema/redoc/` | ||
# backend | ||
|
||
## Схема базы данных | ||
Обновление картинки после изменения dbml с помощью команды: | ||
``` | ||
npx --package=@softwaretechnik/dbml-renderer -- dbml-renderer -i docs/db.dbml -o docs/db.svg | ||
``` | ||
|
||
Схему БД в интерактивном режиме можно посмотреть по ссылке: | ||
|
||
[СХЕМА БД](https://dbdiagram.io/d/64bb081202bd1c4a5e7f8c0b) | ||
|
||
|
||
|
||
## Документация API | ||
В проекте реализована автоматическая генерация документации. Документация доступна по адресам: | ||
1) Swagger: `/api/v1/schema/swagger-ui/` | ||
2) Redoc: `/api/v1/schema/redoc/` | ||
|
||
|
||
|
||
## Запуск в режиме разработки | ||
|
||
1. Убедитесь, что у вас установлены Docker и Docker Compose. | ||
|
||
2. Склонируйте данный репозиторий на свой локальный компьютер: | ||
|
||
```bash | ||
git clone https://github.com/b2b-marketplace/b2b-marketplace-backend.git | ||
``` | ||
|
||
3. Перейдите в директорию с проектом: | ||
|
||
```bash | ||
cd b2b-marketplace-backend | ||
``` | ||
|
||
4. Создайте файл .env внутри директории infra с переменными окружения | ||
и скопируйте в него данные из файла ".env.example": | ||
|
||
```bash | ||
touch infra/.env | ||
``` | ||
|
||
5. Соберите Docker-образы и запустите контейнеры: | ||
|
||
```bash | ||
docker-compose -f infra/docker-compose.dev.yml build | ||
``` | ||
|
||
```bash | ||
docker-compose -f infra/docker-compose.dev.yml up -d | ||
``` | ||
6. После успешного запуска, Django приложение будет | ||
доступно по адресу http://localhost:8000/. | ||
|
||
7. Теперь вы можете войти в административную панель Django | ||
по адресу http://localhost:8000/admin/, | ||
используя созданные учетные данные: | ||
``` | ||
username: admin | ||
пароль: mysecretpassword | ||
``` | ||
8. Вы можете остановить контейнеры с помощью команды: | ||
|
||
```bash | ||
docker-compose -f infra/docker-compose.dev.yml down | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM python:3.9-slim | ||
|
||
RUN pip install poetry | ||
|
||
WORKDIR /app | ||
|
||
COPY ../pyproject.toml ../poetry.lock /app/ | ||
|
||
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi | ||
|
||
COPY . /app/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: "3.8" | ||
volumes: | ||
pg_data: | ||
|
||
services: | ||
db: | ||
image: postgres:15.3 | ||
container_name: b2b-marketplace-db-local | ||
restart: on-failure | ||
volumes: | ||
- pg_data:/var/lib/postgresql/data | ||
env_file: | ||
- .env | ||
ports: | ||
- "${POSTGRES_PORT}:5432" | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER"] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,18 @@ services: | |
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
backend: | ||
build: | ||
context: ../ | ||
dockerfile: infra/Dockerfile.dev | ||
container_name: b2b-marketplace-backend | ||
command: > | ||
sh -c "poetry run python manage.py migrate && | ||
poetry run python manage.py createsuperuser --no-input --username admin --email [email protected] && | ||
poetry run python manage.py runserver 0.0.0.0:8000" | ||
ports: | ||
- "8000:8000" | ||
env_file: | ||
- .env | ||
depends_on: | ||
- db |