我正在使用 Tortoise ORM 作为异步 orm 库制作一个示例 Fast Api 服务器,但我似乎无法返回我定义的关系。这些是我的关系:
# Category
from tortoise.fields.data import DatetimeField
from tortoise.models import Model
from tortoise.fields import UUIDField, CharField
from tortoise.fields.relational import ManyToManyField
from tortoise.contrib.pydantic import pydantic_model_creator
class Category(Model):
id = UUIDField(pk=True)
name = CharField(max_length=255)
description = CharField(max_length=255)
keywords = ManyToManyField(
"models.Keyword", related_name="categories", through="category_keywords"
)
created_on = DatetimeField(auto_now_add=True)
updated_on = DatetimeField(auto_now=True)
Category_dto = pydantic_model_creator(Category, name="Category", allow_cycles = True)
Run Code Online (Sandbox Code Playgroud)
# Keyword
from models.expense import Expense
from models.category import Category
from tortoise.fields.data import DatetimeField
from tortoise.fields.relational import …Run Code Online (Sandbox Code Playgroud) 一段时间以来,我一直在尝试弄清楚如何设置节点调试进程的附件,这些进程在我的环境中从单一存储库设置中的多个正在运行的 Nestjs 应用程序中公开。(用VS代码)
https://github.com/bozvul993/nest-testing-mono-repo-debug
理想情况下,我希望在代码更改时重新启动调试会话[如果可能的话],但更重要的是工作。
我已经为我的示例项目提供了一个存储库。运行/docker文件夹
内的应用程序docker-compose -f dev.yml up
这将显示 monorepo 中的三个应用程序。所有向主机公开其默认节点调试端口的应用程序...
我用来尝试此操作的 vs code 启动配置包括:
"type": "node",
"request": "attach",
"name": "Debug App1",
"address": "0.0.0.0",
"port": 9231,
"localRoot": "${workspaceFolder}/mono-repo",
"remoteRoot": "/app/mono-repo",
"trace": true,
"restart": true,
"sourceMaps": true,
"skipFiles": [
"<node_internals>/**"
]
}
With Web-storm this was easier to achieve somehow..
Run Code Online (Sandbox Code Playgroud) debugging ×1
fastapi ×1
nestjs ×1
node.js ×1
postgresql ×1
pydantic ×1
python ×1
tortoise-orm ×1