Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge #64

Merged
merged 2 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion server/apps/research/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
from .views import ArticleViewSet, index
from django.conf import settings
from django.conf.urls.static import static
from .utils import astro_proxy

router = DefaultRouter()
router.register(r'articles', ArticleViewSet, basename='article')

urlpatterns = [
path('', index, name='index'),
path('', astro_proxy, name='astro_proxy'),
path('api/', include(router.urls)),

# Custom URL for retrieving articles by slug or UUID
Expand Down
6 changes: 6 additions & 0 deletions server/apps/research/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.http import HttpResponse
import requests

def astro_proxy(request):
response = requests.get('http://localhost:4321' + request.path)
return HttpResponse(response.content, content_type=response.headers['Content-Type'])
3 changes: 2 additions & 1 deletion server/apps/research/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
from django.shortcuts import render
from rest_framework import viewsets, status
from rest_framework.response import Response
from .utils import astro_proxy
import uuid

from .models import Article
from .permissions import ArticleUserWritePermission
from .serializers import ArticleSerializer, ArticleCreateUpdateSerializer

def index(request):
return render(request, 'index.html')
return astro_proxy(request)


class ArticleViewSet(viewsets.ModelViewSet):
Expand Down
1 change: 1 addition & 0 deletions server/core/config/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,4 @@
from .ckeditor import *
from .celery_config import *
from .mail import *

5 changes: 4 additions & 1 deletion server/core/config/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,7 @@

SECURE_SSL_REDIRECT = False

SESSION_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True

#PROXY_SETTING for Astro server
PROXY_ASTERISK = True