bug fixed
parent
5f1b9da77e
commit
9e7e8eee4e
|
|
@ -2,13 +2,10 @@ from fastapi import FastAPI
|
||||||
from sqladmin import Admin
|
from sqladmin import Admin
|
||||||
|
|
||||||
from app.database.session import engine
|
from app.database.session import engine
|
||||||
from app.lyric.api.lyrics_admin import (
|
from app.home.api.home_admin import ImageAdmin, ProjectAdmin
|
||||||
LyricsAttributeAdmin,
|
from app.lyric.api.lyrics_admin import LyricAdmin
|
||||||
LyricsPromptTemplateAdmin,
|
from app.song.api.song_admin import SongAdmin
|
||||||
LyricsSongResultsAllAdmin,
|
from app.video.api.video_admin import VideoAdmin
|
||||||
LyricsSongSampleAdmin,
|
|
||||||
LyricsStoreDefaultInfoAdmin,
|
|
||||||
)
|
|
||||||
from config import prj_settings
|
from config import prj_settings
|
||||||
|
|
||||||
# https://github.com/aminalaee/sqladmin
|
# https://github.com/aminalaee/sqladmin
|
||||||
|
|
@ -25,10 +22,17 @@ def init_admin(
|
||||||
base_url=base_url,
|
base_url=base_url,
|
||||||
)
|
)
|
||||||
|
|
||||||
admin.add_view(LyricsStoreDefaultInfoAdmin)
|
# 프로젝트 관리
|
||||||
admin.add_view(LyricsAttributeAdmin)
|
admin.add_view(ProjectAdmin)
|
||||||
admin.add_view(LyricsSongSampleAdmin)
|
admin.add_view(ImageAdmin)
|
||||||
admin.add_view(LyricsPromptTemplateAdmin)
|
|
||||||
admin.add_view(LyricsSongResultsAllAdmin)
|
# 가사 관리
|
||||||
|
admin.add_view(LyricAdmin)
|
||||||
|
|
||||||
|
# 노래 관리
|
||||||
|
admin.add_view(SongAdmin)
|
||||||
|
|
||||||
|
# 영상 관리
|
||||||
|
admin.add_view(VideoAdmin)
|
||||||
|
|
||||||
return admin
|
return admin
|
||||||
|
|
|
||||||
|
|
@ -37,19 +37,16 @@ AsyncSessionLocal = async_sessionmaker(
|
||||||
|
|
||||||
|
|
||||||
async def create_db_tables():
|
async def create_db_tables():
|
||||||
async with engine.begin() as connection:
|
import asyncio
|
||||||
from app.lyric.models import ( # noqa: F401
|
|
||||||
Attribute,
|
# 모델 import (테이블 메타데이터 등록용)
|
||||||
PromptTemplate,
|
from app.home.models import Image, Project # noqa: F401
|
||||||
SongResultsAll,
|
from app.lyric.models import Lyric # noqa: F401
|
||||||
SongSample,
|
from app.song.models import Song # noqa: F401
|
||||||
StoreDefaultInfo,
|
from app.video.models import Video # noqa: F401
|
||||||
)
|
|
||||||
|
|
||||||
print("Creating database tables...")
|
print("Creating database tables...")
|
||||||
|
|
||||||
import asyncio
|
|
||||||
|
|
||||||
async with asyncio.timeout(10):
|
async with asyncio.timeout(10):
|
||||||
async with engine.begin() as connection:
|
async with engine.begin() as connection:
|
||||||
await connection.run_sync(Base.metadata.create_all)
|
await connection.run_sync(Base.metadata.create_all)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue