Skip to content

Commit 2e5bb58

Browse files
author
user
committed
Make it able to launch by gunicorn
1 parent 958e696 commit 2e5bb58

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

backend/app/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from flask import Flask, jsonify, request
22
from flask_cors import CORS
3-
from app.services.topic_service import TopicService
4-
from app.services.ai_service import AITopicProcessor
3+
from services.topic_service import TopicService
4+
from services.ai_service import AITopicProcessor
55

66
app = Flask(__name__)
77
CORS(app, resources={
@@ -77,4 +77,4 @@ def home():
7777
print("Starting Flask server...")
7878
port = 5002
7979
print(f"Server running on: http://127.0.0.1:{port}")
80-
app.run(host='127.0.0.1', port=port, debug=True)
80+
app.run(host='127.0.0.1', port=port, debug=True)

backend/app/services/topic_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from collections import Counter
22
import duckdb
3-
from app.utils.cache import get_cached_topics, save_cached_topics
3+
from utils.cache import get_cached_topics, save_cached_topics
44
import os
55

66
class TopicService:
@@ -13,7 +13,7 @@ class TopicService:
1313
}
1414

1515
def __init__(self):
16-
db_path = '../public/data/github_meta.duckdb'
16+
db_path = '../../public/data/github_meta.duckdb'
1717

1818
# Check if database exists
1919
if os.path.exists(db_path):
@@ -82,4 +82,4 @@ def process_topics(self, search_term: str):
8282
"success": False,
8383
"error": str(e),
8484
"message": "An error occurred while processing the request"
85-
}
85+
}

backend/app/utils/cache.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
import json
33

44
def get_cached_topics(search_term):
5-
cache_file = Path('../public/data/cached_topics') / f"{search_term}.json"
5+
cache_file = Path('../../public/data/cached_topics') / f"{search_term}.json"
66
if cache_file.exists():
77
with open(cache_file, 'r') as f:
88
return json.load(f)
99
return None
1010

1111
def save_cached_topics(search_term, topics_data):
12-
cache_dir = Path('../public/data/cached_topics')
12+
cache_dir = Path('../../public/data/cached_topics')
1313
cache_dir.mkdir(exist_ok=True)
1414
cache_file = cache_dir / f"{search_term}.json"
1515
with open(cache_file, 'w') as f:
16-
json.dump(topics_data, f)
16+
json.dump(topics_data, f)

0 commit comments

Comments
 (0)