Skip to content

Commit 65b36b3

Browse files
committed
refactor: Streamlit 메인 실행 모듈과 페이지 설정 분리
1 parent 3636b89 commit 65b36b3

File tree

2 files changed

+54
-20
lines changed

2 files changed

+54
-20
lines changed

interface/pages_config.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
Streamlit 애플리케이션 페이지 설정 모듈.
3+
4+
각 페이지의 경로와 제목을 정의하여 내비게이션에 사용합니다.
5+
6+
Attributes:
7+
PAGES (list): Streamlit Page 객체 리스트.
8+
- 홈 페이지
9+
- Lang2SQL 페이지
10+
- 그래프 빌더 페이지
11+
"""
12+
13+
import streamlit as st
14+
15+
PAGES = [
16+
st.Page("app_pages/home.py", title="🏠 홈"),
17+
st.Page("app_pages/lang2sql.py", title="🔍 Lang2SQL"),
18+
st.Page("app_pages/graph_builder.py", title="📊 그래프 빌더"),
19+
]

interface/streamlit_app.py

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
11
"""
22
Streamlit 애플리케이션 메인 실행 모듈.
33
4-
이 모듈은 Lang2SQL 데이터 분석 도구의 내비게이션을 정의하고,
5-
각 페이지를 연결하여 사용자가 원하는 기능을 선택할 수 있도록 합니다.
6-
7-
Example:
8-
$ streamlit run interface/streamlit_app.py
4+
Lang2SQL 데이터 분석 도구의 내비게이션을 초기화하고 실행합니다.
95
"""
106

117
import streamlit as st
128

13-
st.set_page_config(
14-
page_title="Lang2SQL 데이터 분석 도구",
15-
page_icon="🔎",
16-
layout="wide",
17-
initial_sidebar_state="expanded",
18-
)
19-
20-
PAGES = [
21-
st.Page("app_pages/home.py", title="🏠 홈"),
22-
st.Page("app_pages/lang2sql.py", title="🔍 Lang2SQL"),
23-
st.Page("app_pages/graph_builder.py", title="📊 그래프 빌더"),
24-
]
25-
26-
pg = st.navigation(PAGES)
27-
pg.run()
9+
from interface.pages_config import PAGES
10+
11+
12+
def configure_app() -> None:
13+
"""앱 전역 설정 초기화.
14+
15+
Streamlit 애플리케이션의 제목, 아이콘, 레이아웃, 사이드바 상태를 설정합니다.
16+
17+
Returns:
18+
None
19+
"""
20+
st.set_page_config(
21+
page_title="Lang2SQL 데이터 분석 도구",
22+
page_icon="🔎",
23+
layout="wide",
24+
initial_sidebar_state="expanded",
25+
)
26+
27+
28+
def main() -> None:
29+
"""애플리케이션 진입점.
30+
31+
전역 설정을 초기화하고, 정의된 페이지 내비게이션을 실행합니다.
32+
33+
Returns:
34+
None
35+
"""
36+
configure_app()
37+
pg = st.navigation(PAGES)
38+
pg.run()
39+
40+
41+
if __name__ == "__main__":
42+
main()

0 commit comments

Comments
 (0)