diff --git a/boot.sh b/boot.sh index d76fa75a0..0d1d47d9e 100644 --- a/boot.sh +++ b/boot.sh @@ -4,6 +4,7 @@ source venv/bin/activate echo "Updating database" python manage.py migrate python manage.py collectstatic --noinput +python manage.py collectstatic_js_reverse echo "Done" chmod -R 755 /opt/recipes/mediafiles diff --git a/cookbook/templates/javascript_urls.html b/cookbook/templates/javascript_urls.html new file mode 100644 index 000000000..5eb1ca0a3 --- /dev/null +++ b/cookbook/templates/javascript_urls.html @@ -0,0 +1,18 @@ + + + \ No newline at end of file diff --git a/cookbook/templates/test.html b/cookbook/templates/test.html index 79ceb0a6c..8bf6d6e6b 100644 --- a/cookbook/templates/test.html +++ b/cookbook/templates/test.html @@ -16,8 +16,15 @@ {% block script %} + {% if debug %} + + {% else %} + + {% endif %} + {% render_bundle 'chunk-vendors' %} diff --git a/recipes/settings.py b/recipes/settings.py index 4893cda59..1146fb2fb 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -24,6 +24,10 @@ SECRET_KEY = os.getenv('SECRET_KEY') if os.getenv('SECRET_KEY') else 'INSECURE_S DEBUG = bool(int(os.getenv('DEBUG', True))) +INTERNAL_IPS = [ + '127.0.0.1', +] + # allow djangos wsgi server to server mediafiles GUNICORN_MEDIA = bool(int(os.getenv('GUNICORN_MEDIA', True))) @@ -74,6 +78,7 @@ INSTALLED_APPS = [ 'rest_framework.authtoken', 'django_cleanup.apps.CleanupConfig', 'webpack_loader', + 'django_js_reverse', 'cookbook.apps.CookbookConfig', ] diff --git a/recipes/urls.py b/recipes/urls.py index d975d22ca..26b54a96c 100644 --- a/recipes/urls.py +++ b/recipes/urls.py @@ -20,6 +20,7 @@ from django.contrib import admin from django.urls import include, path from django.views.i18n import JavaScriptCatalog from django.views.static import serve +from django_js_reverse import views as reverse_views urlpatterns = [ path('', include('cookbook.urls')), @@ -31,6 +32,7 @@ urlpatterns = [ JavaScriptCatalog.as_view(domain='django'), name='javascript-catalog' ), + url(r'^jsreverse.json$', reverse_views.urls_js, name='js_reverse'), ] if settings.GUNICORN_MEDIA or settings.DEBUG: diff --git a/requirements.txt b/requirements.txt index ef3ba1dcc..35fb9e721 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,3 +29,4 @@ microdata==0.7.1 django-random-queryset==0.1.3 Jinja2==2.11.2 django-webpack-loader==0.7.0 +django-js-reverse==0.9.1 \ No newline at end of file diff --git a/vue/src/apps/RecipeView/RecipeView.vue b/vue/src/apps/RecipeView/RecipeView.vue index cc991696b..c74988669 100644 --- a/vue/src/apps/RecipeView/RecipeView.vue +++ b/vue/src/apps/RecipeView/RecipeView.vue @@ -1,6 +1,7 @@