mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-11-22 00:03:28 +01:00
removes redundant usage of FRONTEND_HOST variable (#102)
This commit is contained in:
parent
3b35ce0262
commit
2552551662
@ -87,7 +87,7 @@ git clone https://github.com/mediacms-io/mediacms
|
||||
cd mediacms
|
||||
```
|
||||
|
||||
The default option to serve MediaCMS is on http://localhost. If you want to set a url and have it served there, set the `FRONTEND_HOST` variable on file `deploy/docker/local_settings.py`.
|
||||
The default option is to serve MediaCMS on all ips available of the server (including localhost).
|
||||
|
||||
Now run
|
||||
|
||||
@ -95,7 +95,7 @@ Now run
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
This will download all MediaCMS related Docker images and start all containers. Once it finishes, MediaCMS will be installed and available on http://localhost (or the url you've set as `FRONTEND_HOST` on file `deploy/docker/local_settings.py`)
|
||||
This will download all MediaCMS related Docker images and start all containers. Once it finishes, MediaCMS will be installed and available on http://localhost or http://ip
|
||||
|
||||
For more instructions, checkout the docs on the [Docker deployment](docs/Docker_deployment.md) page. Docker Compose support has been contributed by @swiftugandan.
|
||||
|
||||
|
@ -42,7 +42,11 @@ ALLOW_RATINGS_CONFIRMED_EMAIL_ONLY = True
|
||||
|
||||
# ip of the server should be part of this
|
||||
ALLOWED_HOSTS = ["*", "mediacms.io", "127.0.0.1", "localhost"]
|
||||
|
||||
FRONTEND_HOST = "http://localhost"
|
||||
# this variable - along with SSL_FRONTEND_HOST is used on several places
|
||||
# as email where a URL need appear etc
|
||||
|
||||
# FRONTEND_HOST needs an http prefix - at the end of the file
|
||||
# there's a conversion to https with the SSL_FRONTEND_HOST env
|
||||
INTERNAL_IPS = "127.0.0.1"
|
||||
|
@ -7,15 +7,15 @@ server {
|
||||
|
||||
error_log /var/log/nginx/mediacms.io.error.log warn;
|
||||
|
||||
# redirect to https if logged in
|
||||
if ($http_cookie ~* "sessionid") {
|
||||
rewrite ^/(.*)$ https://localhost/$1 permanent;
|
||||
}
|
||||
# # redirect to https if logged in
|
||||
# if ($http_cookie ~* "sessionid") {
|
||||
# rewrite ^/(.*)$ https://localhost/$1 permanent;
|
||||
# }
|
||||
|
||||
# redirect basic forms to https
|
||||
location ~ (login|login_form|register|mail_password_form)$ {
|
||||
rewrite ^/(.*)$ https://localhost/$1 permanent;
|
||||
}
|
||||
# # redirect basic forms to https
|
||||
# location ~ (login|login_form|register|mail_password_form)$ {
|
||||
# rewrite ^/(.*)$ https://localhost/$1 permanent;
|
||||
# }
|
||||
|
||||
location /static {
|
||||
alias /home/mediacms.io/mediacms/static ;
|
||||
|
@ -5,12 +5,7 @@ from .methods import is_mediacms_editor, is_mediacms_manager
|
||||
def stuff(request):
|
||||
"""Pass settings to the frontend"""
|
||||
ret = {}
|
||||
if request.is_secure():
|
||||
# in case session is https, pass this setting so
|
||||
# that the frontend uses https too
|
||||
ret["FRONTEND_HOST"] = settings.SSL_FRONTEND_HOST
|
||||
else:
|
||||
ret["FRONTEND_HOST"] = settings.FRONTEND_HOST
|
||||
ret["FRONTEND_HOST"] = request.build_absolute_uri('/')
|
||||
ret["DEFAULT_THEME"] = settings.DEFAULT_THEME
|
||||
ret["PORTAL_NAME"] = settings.PORTAL_NAME
|
||||
ret["LOAD_FROM_CDN"] = settings.LOAD_FROM_CDN
|
||||
|
@ -1,37 +1,37 @@
|
||||
MediaCMS.url = {
|
||||
home: "{{FRONTEND_HOST}}",
|
||||
search: "{{FRONTEND_HOST}}/search",
|
||||
latestMedia: "{{FRONTEND_HOST}}/latest",
|
||||
featuredMedia: "{{FRONTEND_HOST}}/featured",
|
||||
recommendedMedia: "{{FRONTEND_HOST}}/recommended",
|
||||
members: "{{FRONTEND_HOST}}/members",
|
||||
home: "/",
|
||||
search: "/search",
|
||||
latestMedia: "/latest",
|
||||
featuredMedia: "/featured",
|
||||
recommendedMedia: "/recommended",
|
||||
members: "/members",
|
||||
/* Error pages */
|
||||
error404: "{{FRONTEND_HOST}}/error",
|
||||
error404: "/error",
|
||||
/* Taxonomies pages */
|
||||
tags: "{{FRONTEND_HOST}}/tags",
|
||||
categories: "{{FRONTEND_HOST}}/categories",
|
||||
topics: "{{FRONTEND_HOST}}/topics",
|
||||
languages: "{{FRONTEND_HOST}}/languages",
|
||||
countries: "{{FRONTEND_HOST}}/countries",
|
||||
tags: "/tags",
|
||||
categories: "/categories",
|
||||
topics: "/topics",
|
||||
languages: "/languages",
|
||||
countries: "/countries",
|
||||
/* User pages */
|
||||
likedMedia: "{{FRONTEND_HOST}}/liked",
|
||||
history: "{{FRONTEND_HOST}}/history",
|
||||
likedMedia: "/liked",
|
||||
history: "/history",
|
||||
/* Add/edit pages */
|
||||
addMedia: "{{FRONTEND_HOST}}/upload",
|
||||
addMedia: "/upload",
|
||||
/* User account pages */
|
||||
editProfile: "{{user.edit_url}}",
|
||||
{% if request.user.is_authenticated %}
|
||||
signout: "{{FRONTEND_HOST}}/accounts/logout/",
|
||||
signout: "/accounts/logout/",
|
||||
editChannel: "{{user.default_channel_edit_url}}",
|
||||
changePassword: "{{FRONTEND_HOST}}/accounts/password/change/",
|
||||
changePassword: "/accounts/password/change/",
|
||||
/* Administration pages */
|
||||
{% if IS_MEDIACMS_ADMIN %}admin: '/admin',{% endif %}
|
||||
/* Management pages */
|
||||
{% if IS_MEDIACMS_ADMIN or IS_MEDIACMS_MANAGER or IS_MEDIACMS_EDITOR %}manageMedia: "{{FRONTEND_HOST}}/manage/media",{% endif %}
|
||||
{% if IS_MEDIACMS_ADMIN or IS_MEDIACMS_MANAGER %}manageUsers: "{{FRONTEND_HOST}}/manage/users",{% endif %}
|
||||
{% if IS_MEDIACMS_ADMIN or IS_MEDIACMS_MANAGER or IS_MEDIACMS_EDITOR %}manageComments: "{{FRONTEND_HOST}}/manage/comments",{% endif %}
|
||||
{% if IS_MEDIACMS_EDITOR %}manageMedia: "/manage/media",{% endif %}
|
||||
{% if IS_MEDIACMS_MANAGER %}manageUsers: "/manage/users",{% endif %}
|
||||
{% if IS_MEDIACMS_EDITOR %}manageComments: "/manage/comments",{% endif %}
|
||||
{% else %}
|
||||
signin: "{{FRONTEND_HOST}}/accounts/login/",
|
||||
register: "{{FRONTEND_HOST}}/accounts/signup/",
|
||||
signin: "/accounts/login/",
|
||||
register: "/accounts/signup/",
|
||||
{% endif %}
|
||||
};
|
||||
|
@ -1,8 +1,8 @@
|
||||
MediaCMS.site = {
|
||||
id: 'mediacms',
|
||||
title: "{{PORTAL_NAME}}",
|
||||
url: '{{FRONTEND_HOST}}/',
|
||||
api: '{{FRONTEND_HOST}}/api/v1',
|
||||
url: '{{FRONTEND_HOST}}',
|
||||
api: '{{FRONTEND_HOST}}api/v1',
|
||||
theme: {
|
||||
mode: 'light', // Valid values: 'light', 'dark'.
|
||||
switch: {
|
||||
@ -11,12 +11,12 @@ MediaCMS.site = {
|
||||
},
|
||||
logo:{
|
||||
lightMode:{
|
||||
img: "{{FRONTEND_HOST}}/static/images/logo_dark.png",
|
||||
svg: "{{FRONTEND_HOST}}/static/images/logo_dark.svg",
|
||||
img: "/static/images/logo_dark.png",
|
||||
svg: "/static/images/logo_dark.svg",
|
||||
},
|
||||
darkMode:{
|
||||
img: "{{FRONTEND_HOST}}/static/images/logo_light.png",
|
||||
svg: "{{FRONTEND_HOST}}/static/images/logo_light.svg",
|
||||
img: "/static/images/logo_light.png",
|
||||
svg: "/static/images/logo_light.svg",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
@ -50,3 +50,4 @@ MediaCMS.site = {
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user