possibly fixed sub path hosting issues

This commit is contained in:
vabene1111
2021-10-29 11:29:55 +02:00
parent 6c8843ca74
commit 6949e17a33
15 changed files with 36 additions and 6 deletions

View File

@ -41,10 +41,17 @@ SHOPPING_MIN_AUTOSYNC_INTERVAL=5
# Default for user setting sticky navbar
# STICKY_NAV_PREF_DEFAULT=1
# If staticfiles are stored at a different location uncomment and change accordingly
# If base URL is something other than just / (you are serving a subfolder in your proxy for instance http://recipe_app/recipes/)
# SCRIPT_NAME=/recipes
# If staticfiles are stored at a different location uncomment and change accordingly, MUST END IN /
# this is not required if you are just using a subfolder
# This can either be a relative path from the applications base path or the url of an external host
# STATIC_URL=/static/
# If mediafiles are stored at a different location uncomment and change accordingly
# If mediafiles are stored at a different location uncomment and change accordingly, MUST END IN /
# this is not required if you are just using a subfolder
# This can either be a relative path from the applications base path or the url of an external host
# MEDIA_URL=/media/
# Serve mediafiles directly using gunicorn. Basically everyone recommends not doing this. Please use any of the examples
@ -79,8 +86,6 @@ GUNICORN_MEDIA=0
# when unset: 0 (false)
REVERSE_PROXY_AUTH=0
# If base URL is something other than just / (you are serving a subfolder in your proxy for instance http://recipe_app/recipes/)
# SCRIPT_NAME=/recipes
# Default settings for spaces, apply per space and can be changed in the admin view
# SPACE_DEFAULT_MAX_RECIPES=0 # 0=unlimited recipes
# SPACE_DEFAULT_MAX_USERS=0 # 0=unlimited users per space

View File

@ -38,6 +38,8 @@ class ExtendedRecipeMixin(serializers.ModelSerializer):
return fields
except AttributeError:
pass
except KeyError:
pass
del fields['image']
del fields['numrecipe']
return fields

View File

@ -344,6 +344,7 @@
<script type="application/javascript">
localStorage.setItem('SCRIPT_NAME', "{% base_path request 'script' %}")
localStorage.setItem('BASE_PATH', "{% base_path request 'base' %}")
localStorage.setItem('STATIC_URL', "{% base_path request 'static_base' %}")
window.addEventListener("load", () => {
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("{% url 'service_worker' %}", {scope: "{% base_path request 'base' %}" + '/'}).then(function (reg) {

View File

@ -153,3 +153,5 @@ def base_path(request, path_type):
return request._current_scheme_host + request.META.get('HTTP_X_SCRIPT_NAME', '')
elif path_type == 'script':
return request.META.get('HTTP_X_SCRIPT_NAME', '')
elif path_type == 'static_base':
return static('vue/manifest.json').replace('vue/manifest.json', '')

View File

@ -4,6 +4,8 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
export default __webpack_public_path__ = localStorage.STATIC_URL + 'vue/' // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,8 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
export default __webpack_public_path__ = localStorage.STATIC_URL + 'vue/' // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,8 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
export default __webpack_public_path__ = localStorage.STATIC_URL + 'vue/' // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,8 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
export default __webpack_public_path__ = localStorage.STATIC_URL + 'vue/' // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,8 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
export default __webpack_public_path__ = localStorage.STATIC_URL + 'vue/' // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,8 @@ import i18n from "@/i18n";
Vue.config.productionTip = false
export default __webpack_public_path__ = localStorage.STATIC_URL + 'vue/' // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,8 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
export default __webpack_public_path__ = localStorage.STATIC_URL + 'vue/' // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,8 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
export default __webpack_public_path__ = localStorage.STATIC_URL + 'vue/' // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,8 @@ import i18n from "@/i18n";
Vue.config.productionTip = false
export default __webpack_public_path__ = localStorage.STATIC_URL + 'vue/' // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,8 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
export default __webpack_public_path__ = localStorage.STATIC_URL + 'vue/' // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -48,7 +48,7 @@ module.exports = {
filenameHashing: false,
productionSourceMap: false,
publicPath: process.env.NODE_ENV === 'production'
? '/static/vue'
? ''
: 'http://localhost:8080/',
outputDir: '../cookbook/static/vue/',
runtimeCompiler: true,