diff --git a/ollamate/settings.py b/ollamate/settings.py index 4587455..2103b0c 100644 --- a/ollamate/settings.py +++ b/ollamate/settings.py @@ -9,11 +9,10 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/5.0/ref/settings/ """ - -from pathlib import Path - import os import environ +from pathlib import Path + # Initialize environment variables env = environ.Env() @@ -98,9 +97,7 @@ DB_HOST = os.environ.get("DB_HOST", "127.0.0.1") ENABLE_DB_SSL = ( - str( - os.environ.get("ENABLE_DB_SSL", DB_HOST not in ["127.0.0.1", "localhost"]) - ).lower() + str(os.environ.get("ENABLE_DB_SSL", DB_HOST not in ["127.0.0.1", "localhost"])).lower() == "true" ) DATABASES: dict = { diff --git a/ollamate/urls.py b/ollamate/urls.py index ed41375..0508610 100644 --- a/ollamate/urls.py +++ b/ollamate/urls.py @@ -1,21 +1,5 @@ -""" -URL configuration for ollamate project. - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/5.0/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: path('', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.urls import include, path - 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -""" from django.contrib import admin -from django.urls import path, include +from django.urls import include, path from streamingapp.views import redirect_to_ollama urlpatterns = [ diff --git a/streamingapp/urls.py b/streamingapp/urls.py index 4175580..01c2651 100644 --- a/streamingapp/urls.py +++ b/streamingapp/urls.py @@ -1,4 +1,5 @@ from django.urls import path + from . import views urlpatterns = [ diff --git a/streamingapp/views.py b/streamingapp/views.py index 662a79a..5ecaa7e 100644 --- a/streamingapp/views.py +++ b/streamingapp/views.py @@ -34,9 +34,7 @@ def call_ollama(request): ollama_response = response_data.get("message", {}).get("content", "") if not ollama_response: logging.error("Empty response from Ollama API") - return JsonResponse( - {"error": "Empty response from Ollama API"}, status=500 - ) + return JsonResponse({"error": "Empty response from Ollama API"}, status=500) return JsonResponse({"response": ollama_response}) except requests.RequestException as e: