Skip to content

Commit

Permalink
Added research app
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvan2006 committed Sep 11, 2024
1 parent d5a2544 commit 454d76b
Show file tree
Hide file tree
Showing 12 changed files with 15,903 additions and 0 deletions.
Empty file added backend/research/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions backend/research/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions backend/research/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class ResearchConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'research'
Empty file.
3 changes: 3 additions & 0 deletions backend/research/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
3 changes: 3 additions & 0 deletions backend/research/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
6 changes: 6 additions & 0 deletions backend/research/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.urls import path
from . import views

urlpatterns = [
path('notebooks/<str:notebook_name>', views.notebook_view, name='notebook_view'),
]
12 changes: 12 additions & 0 deletions backend/research/views.py
Original file line number Diff line number Diff line change
@@ -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")
4 changes: 4 additions & 0 deletions backend/server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
INSTALLED_APPS = [
'liquidity.apps.LiquidityConfig',
'indicators.apps.IndicatorsConfig',
'research.apps.ResearchConfig',
'rest_framework',
'corsheaders',
'django.contrib.admin',
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions backend/server/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]
Loading

0 comments on commit 454d76b

Please sign in to comment.