diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 46c59b2..637eb1a 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -35,6 +35,13 @@
+
+
+
diff --git a/backend/sophon/core/urls.py b/backend/sophon/core/urls.py
index 63b764d..b832935 100644
--- a/backend/sophon/core/urls.py
+++ b/backend/sophon/core/urls.py
@@ -10,4 +10,5 @@ router.register("groups", views.ResearchGroupViewSet, basename="research-group")
urlpatterns = [
path("", include(router.urls)),
+ path("version", views.VersionView.as_view())
]
diff --git a/backend/sophon/core/views.py b/backend/sophon/core/views.py
index 9cadeae..1d4ed9d 100644
--- a/backend/sophon/core/views.py
+++ b/backend/sophon/core/views.py
@@ -2,6 +2,8 @@ import abc
import typing as t
import deprecation
+import pkg_resources
+from rest_framework.views import APIView
from rest_framework.viewsets import ModelViewSet
from rest_framework.response import Response
from rest_framework.serializers import Serializer
@@ -245,3 +247,14 @@ class SophonGroupViewSet(SophonViewSet, metaclass=abc.ABCMeta):
return permissions.Edit,
else:
return permissions.AllowAny,
+
+
+class VersionView(APIView):
+ """
+ Get the Sophon server version.
+ """
+
+ # noinspection PyMethodMayBeStatic,PyUnusedLocal
+ def get(self, request, format=None):
+ version = pkg_resources.get_distribution("sophon").version
+ return Response(version, status=status.HTTP_200_OK)