From 454d76b5e6e62df30a830f5b592117f843f49502 Mon Sep 17 00:00:00 2001 From: Dhruvan Ganadhandayuthapani Date: Wed, 11 Sep 2024 17:27:56 +0200 Subject: [PATCH] Added research app --- backend/research/__init__.py | 0 backend/research/admin.py | 3 + backend/research/apps.py | 6 + backend/research/migrations/__init__.py | 0 backend/research/models.py | 3 + backend/research/tests.py | 3 + backend/research/urls.py | 6 + backend/research/views.py | 12 + backend/server/settings.py | 4 + backend/server/urls.py | 1 + .../notebooks/bitcoin-decay-channel.html | 8002 +++++++++++++++++ .../static/notebooks/thermocap-multiple.html | 7863 ++++++++++++++++ 12 files changed, 15903 insertions(+) create mode 100644 backend/research/__init__.py create mode 100644 backend/research/admin.py create mode 100644 backend/research/apps.py create mode 100644 backend/research/migrations/__init__.py create mode 100644 backend/research/models.py create mode 100644 backend/research/tests.py create mode 100644 backend/research/urls.py create mode 100644 backend/research/views.py create mode 100644 backend/static/notebooks/bitcoin-decay-channel.html create mode 100644 backend/static/notebooks/thermocap-multiple.html diff --git a/backend/research/__init__.py b/backend/research/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/research/admin.py b/backend/research/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/backend/research/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/backend/research/apps.py b/backend/research/apps.py new file mode 100644 index 0000000..f328f61 --- /dev/null +++ b/backend/research/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ResearchConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'research' diff --git a/backend/research/migrations/__init__.py b/backend/research/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/research/models.py b/backend/research/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/backend/research/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/backend/research/tests.py b/backend/research/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/backend/research/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/backend/research/urls.py b/backend/research/urls.py new file mode 100644 index 0000000..650b658 --- /dev/null +++ b/backend/research/urls.py @@ -0,0 +1,6 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('notebooks/', views.notebook_view, name='notebook_view'), +] diff --git a/backend/research/views.py b/backend/research/views.py new file mode 100644 index 0000000..42ae653 --- /dev/null +++ b/backend/research/views.py @@ -0,0 +1,12 @@ +import os +from django.http import HttpResponse, Http404 +from django.conf import settings + +def notebook_view(request, notebook_name): + notebook_path = os.path.join(settings.BASE_DIR, 'static', 'notebooks', f'{notebook_name}.html') + + if os.path.exists(notebook_path): + with open(notebook_path, 'r') as file: + return HttpResponse(file.read(), content_type='text/html') + else: + raise Http404(f"Notebook {notebook_name} not found") diff --git a/backend/server/settings.py b/backend/server/settings.py index a071610..a1dad79 100644 --- a/backend/server/settings.py +++ b/backend/server/settings.py @@ -37,6 +37,7 @@ INSTALLED_APPS = [ 'liquidity.apps.LiquidityConfig', 'indicators.apps.IndicatorsConfig', + 'research.apps.ResearchConfig', 'rest_framework', 'corsheaders', 'django.contrib.admin', @@ -125,6 +126,9 @@ # https://docs.djangoproject.com/en/5.1/howto/static-files/ STATIC_URL = 'static/' +STATICFILES_DIRS = [ + BASE_DIR / 'static', +] # Default primary key field type # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field diff --git a/backend/server/urls.py b/backend/server/urls.py index d4e188a..82c371d 100644 --- a/backend/server/urls.py +++ b/backend/server/urls.py @@ -20,5 +20,6 @@ urlpatterns = [ path('api/liquidity/', include('liquidity.urls')), path('api/indicators/', include('indicators.urls')), + path('api/research/', include('research.urls')), path('admin/', admin.site.urls), ] diff --git a/backend/static/notebooks/bitcoin-decay-channel.html b/backend/static/notebooks/bitcoin-decay-channel.html new file mode 100644 index 0000000..b873708 --- /dev/null +++ b/backend/static/notebooks/bitcoin-decay-channel.html @@ -0,0 +1,8002 @@ + + + + + +bitcoin-decay-channel + + + + + + + + + + + + +
+ + + + + + +
+ + diff --git a/backend/static/notebooks/thermocap-multiple.html b/backend/static/notebooks/thermocap-multiple.html new file mode 100644 index 0000000..a95f02e --- /dev/null +++ b/backend/static/notebooks/thermocap-multiple.html @@ -0,0 +1,7863 @@ + + + + + +thermocap-multiple + + + + + + + + + + + + +
+ + + + +
+ +