Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Julien Jerphanion
Rex Dri
Commits
bfb81152
Commit
bfb81152
authored
Feb 26, 2019
by
Florent Chehab
Browse files
Closes
#63
Should fix bug regarding lack of static files
parent
7266140c
Changes
11
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
bfb81152
...
...
@@ -52,7 +52,7 @@ test_back:
-
postgres:10.5
script
:
-
cd backend
-
pytest base_app/
frontend_app/
backend_app/ --cov-report html
-
pytest base_app/ backend_app/ --cov-report html
artifacts
:
paths
:
-
backend/htmlcov/
...
...
Makefile
View file @
bfb81152
...
...
@@ -13,7 +13,7 @@ reformat_backend:
docker-compose
exec
backend sh
-c
"cd backend && black ."
test_backend
:
docker-compose
exec
backend sh
-c
"cd backend && pytest base_app/
frontend_app/
backend_app/"
docker-compose
exec
backend sh
-c
"cd backend && pytest base_app/ backend_app/"
check_backend
:
docker-compose
exec
backend sh
-c
"cd backend && ./manage.py check"
...
...
backend/base_app/settings.py
View file @
bfb81152
...
...
@@ -13,6 +13,7 @@ from os.path import dirname
import
sys
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
# Is the root of the REPOSITORY
BASE_DIR
=
dirname
(
dirname
(
dirname
(
os
.
path
.
abspath
(
__file__
))))
SECRET_KEY
=
os
.
environ
[
"SECRET_KEY"
]
...
...
@@ -31,7 +32,7 @@ INSTALLED_APPS = [
"rest_framework"
,
"rest_framework.authtoken"
,
"backend_app"
,
"
frontend
_app"
,
"
base
_app"
,
"webpack_loader"
,
]
...
...
@@ -61,14 +62,14 @@ else:
# Webpack loader related
WEBPACK_LOADER
=
{
"DEFAULT"
:
{
"BUNDLE_DIR_NAME"
:
"
frontend
_app/bundles/"
,
"BUNDLE_DIR_NAME"
:
"
base
_app/bundles/"
,
"STATS_FILE"
:
os
.
path
.
join
(
BASE_DIR
,
"frontend/webpack-stats.json"
),
}
}
STATICFILES_DIRS
=
(
os
.
path
.
join
(
BASE_DIR
,
"backend/
static/frontend_app/bundles/
"
BASE_DIR
,
"backend/
base_app/static/base_app
"
),
# We do this so that django's collectstatic copies or our bundles to the STATIC_ROOT or syncs them to whatever storage we use.
)
# End of webpack loader related
...
...
backend/
frontend
_app/static/
frontend
_app
→
backend/
base
_app/static/
base
_app
View file @
bfb81152
File moved
backend/
frontend
_app/templates/
frontend_app/
index.html
→
backend/
base
_app/templates/index.html
View file @
bfb81152
...
...
@@ -18,13 +18,8 @@
</body>
{% load static %}
<!-- <script src="{% static '/frontend_app/react-dist/react.production.min.js' %}"></script> -->
<link
rel=
"stylesheet"
href=
"{% static '/frontend_app/leaflet-dist/leaflet.css' %}"
/>
<link
rel=
"stylesheet"
href=
"{% static '/frontend_app/custom_leaflet.css' %}"
/>
<!-- <link rel="stylesheet" href="{% static '/frontend_app/main.css' %}"/> -->
<!-- <script src="{% static '/frontend_app/leaflet-dist/leaflet.js' %}"></script> -->
<!-- <script src="{% static '/frontend_app/react-leaflet-dist/react-leaflet.js' %}"></script> -->
<!-- <script src="{% static '/frontend_app/main.js' %}"></script> -->
<link
rel=
"stylesheet"
href=
"{% static '/base_app/leaflet-dist/leaflet.css' %}"
/>
<link
rel=
"stylesheet"
href=
"{% static '/base_app/custom_leaflet.css' %}"
/>
{% render_bundle 'main' %}
{% render_bundle 'vendor' %}
...
...
backend/base_app/urls.py
View file @
bfb81152
from
django.conf
import
settings
from
django.conf.urls.static
import
static
from
django.conf.urls
import
include
,
url
from
django.conf.urls.static
import
static
from
django.contrib
import
admin
from
django.views.generic.base
import
RedirectView
import
django_cas_ng.views
from
.
import
views
if
settings
.
DEBUG
:
...
...
@@ -26,7 +28,7 @@ urlpatterns += [
django_cas_ng
.
views
.
CallbackView
.
as_view
(),
name
=
"cas_ng_proxy_callback"
,
),
url
(
r
"^app/.*"
,
include
(
"frontend_app.urls"
)
),
url
(
r
"^app/.*"
,
views
.
index
),
url
(
r
"^$"
,
RedirectView
.
as_view
(
url
=
"./app/"
),
name
=
"go to real home"
),
url
(
r
""
,
include
(
"backend_app.urls"
)),
]
+
static
(
settings
.
MEDIA_URL
,
document_root
=
settings
.
MEDIA_ROOT
)
backend/base_app/views.py
View file @
bfb81152
import
json
import
re
from
django.contrib.auth.models
import
Group
from
backend_app.utils
import
is_member
from
django.http
import
HttpResponse
import
re
import
json
from
django.shortcuts
import
render
from
backend_app.utils
import
is_member
def
role_change
(
request
):
...
...
@@ -26,3 +29,12 @@ def role_change(request):
role
=
"moderator"
return
HttpResponse
(
json
.
dumps
({
"role_actuel"
:
role
}))
def
index
(
request
):
"""
View to to display the index app that contains the JS / CSS
The "template" displayed is in ./templates/index.html
"""
return
render
(
request
,
"index.html"
)
backend/frontend_app/__init__.py
deleted
100644 → 0
View file @
7266140c
backend/frontend_app/apps.py
deleted
100644 → 0
View file @
7266140c
from
django.apps
import
AppConfig
class
FrontendConfig
(
AppConfig
):
name
=
"frontend"
backend/frontend_app/urls.py
deleted
100644 → 0
View file @
7266140c
from
django.urls
import
path
from
.
import
views
urlpatterns
=
[
path
(
""
,
views
.
index
)]
backend/frontend_app/views.py
deleted
100644 → 0
View file @
7266140c
from
django.shortcuts
import
render
def
index
(
request
):
return
render
(
request
,
"frontend_app/index.html"
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment