Skip to content
Snippets Groups Projects
Commit 0ec02520 authored by Fabio Vitello's avatar Fabio Vitello
Browse files

TMSS-175: Fixed 404 responses on frontend

It is now possibile to navigate the react frontend (/frontend url).
parent 4ec397a5
No related branches found
No related tags found
1 merge request!160Resolve TMSS-175
......@@ -30,8 +30,7 @@ http {
location @proxy_to_app {
proxy_pass http://django;
}
location /openid/ {
proxy_pass http://tmss_test_oidc:8088;
}
......
......@@ -39,15 +39,15 @@ USER root
RUN mkdir /staticfiles; chown -R postgres:postgres /staticfiles
ENV VARIANT gnucxx11_opt
ENV PACKAGE TMSS
RUN mv /tmp/lofar /lofar && \
cd /lofar && \
. CMake/gen_LofarPackageList_cmake.sh && \
PACKAGE=TMSS && \
echo "Building $PACKAGE..." && \
mkdir -p build/$VARIANT && \
cd build/$VARIANT && \
mkdir -p build/$VARIANT
RUN cd /lofar/build/$VARIANT && \
cmake -DBUILD_PACKAGES=$PACKAGE ../.. && \
make && \
make install && \
......@@ -59,15 +59,15 @@ USER postgres
# Hot patches
# Configure authentication
RUN echo -e "\n" >> /lofar/build/gnucxx11_opt/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
RUN echo -e "REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES']=[]\n" >> /lofar/build/gnucxx11_opt/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
RUN echo -e "REST_FRAMEWORK['DEFAULT_PERMISSION_CLASSES']=[]\n" >> /lofar/build/gnucxx11_opt/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
RUN echo -e "\n" >> /lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
RUN echo -e "REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES']=[]\n" >> /lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
RUN echo -e "REST_FRAMEWORK['DEFAULT_PERMISSION_CLASSES']=[]\n" >> /lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
# Allow Django HTTP access
RUN echo -e "ALLOWED_HOSTS=['*']\n" >> /lofar/build/gnucxx11_opt/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
RUN echo -e "ALLOWED_HOSTS=['*']\n" >> /lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
RUN echo -e "STATIC_URL = '/static/'\n" >> /lofar/build/gnucxx11_opt/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
RUN echo -e "STATIC_ROOT = '/staticfiles/'\n" >> /lofar/build/gnucxx11_opt/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
RUN echo -e "STATICFILES_DIRS = ['/lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/frontend/frontend_poc/build/static/']\n" >> /lofar/build/gnucxx11_opt/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
RUN echo -e "STATIC_URL = '/static/'\n" >> /lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
RUN echo -e "STATIC_ROOT = '/staticfiles/'\n" >> /lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
RUN echo -e "STATICFILES_DIRS = ['/lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/frontend/frontend_poc/build/static/']\n" >> /lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
ENV POSTGRES_PORT=5444
......@@ -76,11 +76,14 @@ ENV POSTGRES_PASSWORD=test
ENV POSTGRES_USER=test_tmss_user
ENV POSTGRES_HOST=localhost
RUN /bin/bash -c 'export VARIANT=gnucxx11_opt; source /lofar/build/$VARIANT/lofarinit.sh; /usr/bin/python3 /lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/tmss/manage.py collectstatic --clear'
RUN /bin/bash -c 'export VARIANT=gnucxx11_opt; source /lofar/build/$VARIANT/lofarinit.sh; /usr/bin/python3 /lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/tmss/manage.py collectstatic --noinput'
RUN echo "Cleaning static file"
RUN /bin/bash -c 'source /lofar/build/$VARIANT/lofarinit.sh; /usr/bin/python3 /lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/tmss/manage.py collectstatic --clear'
RUN echo "Collecting static file"
RUN /bin/bash -c 'source /lofar/build/$VARIANT/lofarinit.sh; /usr/bin/python3 /lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/tmss/manage.py collectstatic --noinput'
ENTRYPOINT /bin/bash -c 'export VARIANT=gnucxx11_opt; source /lofar/build/$VARIANT/lofarinit.sh;\
ENTRYPOINT /bin/bash -c ' source /lofar/build/$VARIANT/lofarinit.sh;\
tmss_test_database & \
sleep 15 && \
cd /lofar/build/$VARIANT/installed/lib64/python3.6/site-packages/lofar/sas/tmss/ && gunicorn --bind 0.0.0.0:8000 tmss.wsgi'
......
......@@ -12,7 +12,6 @@ import { Route, Link, BrowserRouter as Router } from 'react-router-dom'
const routing = (
<Router>
<div>
<h1>Frontend POC</h1>
<Route exact path="/frontend/" component={App} />
<Route path="/frontend/cycle" component={CycleList} />
<Route path="/frontend/project" component={ProjectList} />
......
import os
from django.http import HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, render
......@@ -21,4 +22,5 @@ def subtask_parset(request, subtask_pk:int):
return HttpResponse(str(parset), content_type='text/plain')
def index(request):
return render(request, "build/index.html")
return render(request, os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), '../../frontend','frontend_poc/build/index.html'))
#return render(request, "../../../frontend/frontend_poc/build/index.html")
......@@ -157,8 +157,9 @@ frontend_urlpatterns = [
path("", views.index, name="index")
]
# prefix everything for proxy
#urlpatterns = [url(r'^api/', include(urlpatterns)), url(r'^oidc/', include('mozilla_django_oidc.urls')),]
urlpatterns = [url(r'^api/', include(urlpatterns)), url(r'^oidc/', include('mozilla_django_oidc.urls')), url(r'^frontend/', include(frontend_urlpatterns)) ,]
urlpatterns = [url(r'^api/', include(urlpatterns)), url(r'^oidc/', include('mozilla_django_oidc.urls')), url(r'^frontend/', include(frontend_urlpatterns)) , url(r'^frontend/(?:.*)/?$', include(frontend_urlpatterns)),]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment