|
@@ -4,6 +4,7 @@ from rest_framework.request import Request
|
|
from django.http import HttpResponse
|
|
from django.http import HttpResponse
|
|
|
|
|
|
from ..Clients.CosmohomeClient import generate_xml_task
|
|
from ..Clients.CosmohomeClient import generate_xml_task
|
|
|
|
+from django.conf import settings
|
|
|
|
|
|
|
|
|
|
class CosmohomeView(viewsets.ViewSet):
|
|
class CosmohomeView(viewsets.ViewSet):
|
|
@@ -16,7 +17,7 @@ class CosmohomeView(viewsets.ViewSet):
|
|
@classmethod
|
|
@classmethod
|
|
@action(methods=['get'], detail=False, url_path='xml')
|
|
@action(methods=['get'], detail=False, url_path='xml')
|
|
def xml(cls, request: Request, *args, **kwargs) -> HttpResponse:
|
|
def xml(cls, request: Request, *args, **kwargs) -> HttpResponse:
|
|
- file = "artifacts/cosmohome_products.xml"
|
|
|
|
|
|
+ file = settings.BASE_DIR / "artifacts/cosmohome_products.xml"
|
|
try:
|
|
try:
|
|
with open(file, 'rb') as f:
|
|
with open(file, 'rb') as f:
|
|
return HttpResponse(f.read(), content_type='text/xml')
|
|
return HttpResponse(f.read(), content_type='text/xml')
|