diff --git a/.env.example b/.env.example index de1ee8f..0a04e3a 100644 --- a/.env.example +++ b/.env.example @@ -19,3 +19,8 @@ GEMINI_MODEL=gemini-1.5-flash # API Integration (Optional) # For Obsidian Plugin or external tools OBSIDIAN_API_TOKEN=your_secret_token_here + +# Server Configuration (Optional) +# Default ports: Windows 5050, Linux 5093 +PORT=5093 +DEBUG=False diff --git a/README.md b/README.md index c9adb72..9d0edac 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,21 @@ cp .env.example .env python brain.py ``` +## ๐ŸŒ ์ ‘์† ๋ฐฉ๋ฒ• + +์„œ๋ฒ„๊ฐ€ ์‹คํ–‰๋˜๋ฉด ๋ธŒ๋ผ์šฐ์ €๋ฅผ ํ†ตํ•ด ๋‹ค์Œ ์ฃผ์†Œ๋กœ ์ ‘์†ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: + +- **๋กœ์ปฌ ์ ‘์† (๋™์ผ PC)**: `http://localhost:5093` +- **์™ธ๋ถ€ ์ ‘์† (ํƒ€ ๊ธฐ๊ธฐ/๋ชจ๋ฐ”์ผ)**: `http://<์„œ๋ฒ„ IP>:5093` + +> [!TIP] +> **ํฌํŠธ ์„ค์ • ๋ณ€๊ฒฝ**: +> ๊ธฐ๋ณธ ํฌํŠธ(์œˆ๋„์šฐ: 5050, ๋ฆฌ๋ˆ…์Šค: 5093) ์™ธ์˜ ๋‹ค๋ฅธ ํฌํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด `.env` ํŒŒ์ผ์—์„œ `PORT=์›ํ•˜๋Š”ํฌํŠธ` ์„ค์ •์„ ์ถ”๊ฐ€ํ•˜์„ธ์š”. + +> [!TIP] +> **๋ฆฌ๋ˆ…์Šค์—์„œ ์„œ๋ฒ„ IP ํ™•์ธํ•˜๊ธฐ**: +> ํ„ฐ๋ฏธ๋„์—์„œ `hostname -I` ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ํ˜„์žฌ ์„œ๋ฒ„์˜ ๋‚ด๋ถ€ IP ์ฃผ์†Œ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. + *`.env` ํŒŒ์ผ์—์„œ ๊ด€๋ฆฌ์ž ์•„์ด๋””์™€ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ๊ผญ ์ˆ˜์ •ํ•˜๊ณ , ํ•„์š”ํ•œ ๊ฒฝ์šฐ์—๋งŒ `GEMINI_API_KEY`๋ฅผ ๋“ฑ๋กํ•˜์„ธ์š”.* --- @@ -170,6 +185,20 @@ We provide a security model where user data is practically undecipherable. Built 2. Create your `.env` from `.env.example` and update your master credentials. 3. Launch the server: `python brain.py` (Default port: 5050 on Windows, 5093 on Linux). +### ๐ŸŒ How to Access +Once the server is running, you can access it via your web browser: + +- **Local Access**: `http://localhost:5093` +- **Remote Access (Mobile/Other PCs)**: `http://:5093` + +> [!TIP] +> **Changing the Port**: +> To use a port other than the default (Windows: 5050, Linux: 5093), add `PORT=your_port` to your `.env` file. + +> [!TIP] +> **Check IP on Linux**: +> Run `hostname -I` in the terminal to find your server's internal IP address. + ---

Developed with โค๏ธ for knowledge lovers.

diff --git a/brain.py b/brain.py index 0f7fe11..b8371a9 100644 --- a/brain.py +++ b/brain.py @@ -7,14 +7,27 @@ from app import create_app app = create_app() if __name__ == "__main__": - # OS ํ™˜๊ฒฝ์— ๋”ฐ๋ฅธ ์„ค์ • ๋ถ„๊ธฐ + # 1. OS ํ™˜๊ฒฝ์— ๋”ฐ๋ฅธ ๊ธฐ๋ณธ๊ฐ’ ์„ค์ • is_windows = platform.system() == "Windows" + default_port = 5050 if is_windows else 5093 + default_debug = True if is_windows else False - # Windows(๊ฐœ๋ฐœ/๋””๋ฒ„๊ทธ): 5050 ํฌํŠธ, Linux(์šด์˜): 5093 ํฌํŠธ - port = 5050 if is_windows else 5093 - debug_mode = True if is_windows else False + # 2. ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์šฐ์„  ์ ์šฉ (PORT) + try: + env_port = os.getenv("PORT") + port = int(env_port) if env_port else default_port + except (ValueError, TypeError): + port = default_port + + # 3. ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์šฐ์„  ์ ์šฉ (DEBUG) + env_debug = os.getenv("DEBUG") + if env_debug is not None: + debug_mode = env_debug.lower() == "true" + else: + debug_mode = default_debug - print(f"๐Ÿ“ก {'Windows' if is_windows else 'Linux'} ํ™˜๊ฒฝ ๊ฐ์ง€ - Port: {port}, Debug: {debug_mode}") + print(f"๐Ÿ“ก {'Windows' if is_windows else 'Linux'} ํ™˜๊ฒฝ ๊ฐ์ง€") + print(f"โš™๏ธ ์„ค์ • ์ ์šฉ - Port: {port}, Debug: {debug_mode}") # ํ–ฅํ›„ Linux ์„œ๋ฒ„ ๊ตฌ์ถ•์‹œ gunicorn / uwsgi ๋กœ ๊ตฌ๋™ ๊ถŒ์žฅ app.run(host="0.0.0.0", port=port, debug=debug_mode) diff --git a/docs/Bug/20260420_readme_access_info.md b/docs/Bug/20260420_readme_access_info.md new file mode 100644 index 0000000..802f3c0 --- /dev/null +++ b/docs/Bug/20260420_readme_access_info.md @@ -0,0 +1,21 @@ +# ๋ฌธ์„œ ๊ฐœ์„ : Linux ํ™˜๊ฒฝ ์ ‘์† ๋ฐฉ๋ฒ• ์ถ”๊ฐ€ (README.md) + +## 1. ๊ฐœ์š” (๋ฒ„๊ทธ/๋ณ€๊ฒฝ ๋‚ด์šฉ) +- ์‚ฌ์šฉ์ž๊ฐ€ README.md์— ์„œ๋ฒ„ ์‹คํ–‰ ๋ฐฉ๋ฒ•์€ ์žˆ์œผ๋‚˜, ์‹ค์ œ ์ ‘์† ๊ฒฝ๋กœ(URL) ์ •๋ณด๊ฐ€ ๋ถ€์กฑํ•จ์„ ์ง€์ ํ•จ. +- ํŠนํžˆ Linux ํ™˜๊ฒฝ์—์„œ์˜ ์ ‘์† ํฌํŠธ(5093)์™€ ์™ธ๋ถ€ ๊ธฐ๊ธฐ์—์„œ์˜ ์ ‘์†์„ ์œ„ํ•œ IP ํ™•์ธ ๋ฐฉ๋ฒ• ์•ˆ๋‚ด๊ฐ€ ํ•„์š”ํ•จ. + +## 2. ์กฐ์น˜ ์‚ฌํ•ญ +- `README.md`์˜ ํ•œ๊ตญ์–ด/์˜์–ด ์„น์…˜์— ๊ฐ๊ฐ '์ ‘์† ๋ฐฉ๋ฒ•(How to Access)' ํ•ญ๋ชฉ์„ ์ถ”๊ฐ€ํ•จ. +- `brain.py` ๋ฆฌํŒฉํ† ๋ง: `.env` ํŒŒ์ผ์˜ `PORT` ๋ฐ `DEBUG` ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋ฅผ ์šฐ์„ ์ ์œผ๋กœ ์ฝ๋„๋ก ์ˆ˜์ •ํ•จ. +- **๋กœ์ปฌ ์ ‘์† ์ฃผ์†Œ**: `http://localhost:5093` (๊ธฐ๋ณธ๊ฐ’) ์•ˆ๋‚ด. +- **์™ธ๋ถ€ ์ ‘์† ์ฃผ์†Œ**: `http://<์„œ๋ฒ„ IP>:5093` (๊ธฐ๋ณธ๊ฐ’) ์•ˆ๋‚ด. +- **ํฌํŠธ ์ปค์Šคํ„ฐ๋งˆ์ด์ง•**: `.env`์—์„œ ์‚ฌ์šฉ์ž๊ฐ€ ์›ํ•˜๋Š” ํฌํŠธ๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ๊ธฐ๋Šฅ ์ถ”๊ฐ€ ๋ฐ `README.md` ๊ฐ€์ด๋“œ ๋ณด์™„. +- **IP ํ™•์ธ ํŒ**: Linux ํ„ฐ๋ฏธ๋„ ๋ช…๋ น `hostname -I`๋ฅผ ์ด์šฉํ•œ ๋‚ด๋ถ€ IP ํ™•์ธ ๋ฐฉ๋ฒ• ์ถ”๊ฐ€. + +## 3. ๊ฒฐ๊ณผ ๋ฐ ๊ฒ€์ฆ +- `README.md` ํŒŒ์ผ์— ํ•ด๋‹น ๋‚ด์šฉ์ด ์ •์ƒ์ ์œผ๋กœ ๋ฐ˜์˜๋จ์„ ํ™•์ธ. +- `brain.py`์˜ ์‹ค์ œ ํฌํŠธ ์„ค์ •(`5093`)๊ณผ ์ผ์น˜ํ•จ. + +## 4. ํ–ฅํ›„ ์ฃผ์˜ ์‚ฌํ•ญ +- ์„œ๋ฒ„์˜ ๊ธฐ๋ณธ ํฌํŠธ๋ฅผ ๋ณ€๊ฒฝํ•  ๊ฒฝ์šฐ, `README.md`์™€ `brain.py`๋ฅผ ํ•จ๊ป˜ ์—…๋ฐ์ดํŠธํ•ด์•ผ ํ•จ. +- ์šด์˜ ํ™˜๊ฒฝ(Linux)๊ณผ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ(Windows)์˜ ํฌํŠธ๊ฐ€ ๋‹ค๋ฅด๋ฏ€๋กœ(5093 vs 5050), ๊ฐ€์ด๋“œ ์ž‘์„ฑ ์‹œ ์ด๋ฅผ ๋ช…ํ™•ํžˆ ๊ตฌ๋ถ„ํ•˜์—ฌ ๊ธฐ์ˆ ํ•ด์•ผ ํ•จ.