BASE_URL environment variable added (#26)

This commit is contained in:
Chris Caron 2020-09-03 12:01:03 -04:00 committed by GitHub
parent 466aa8271e
commit 907743fb8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 111 additions and 23 deletions

View File

@ -153,6 +153,7 @@ The use of environment variables allow you to provide over-rides to default sett
| `APPRISE_STATEFUL_MODE` | This can be set to the following possible modes:<br/>📌 **hash**: This is also the default. It stores the server configuration in a hash formatted that can be easily indexed and compressed.<br/>📌 **simple**: Configuration is written straight to disk using the `{KEY}.cfg` (if `TEXT` based) and `{KEY}.yml` (if `YAML` based).<br/>📌 **disabled**: Straight up deny any read/write queries to the servers stateful store. Effectively turn off the Apprise Stateful feature completely. | `APPRISE_STATEFUL_MODE` | This can be set to the following possible modes:<br/>📌 **hash**: This is also the default. It stores the server configuration in a hash formatted that can be easily indexed and compressed.<br/>📌 **simple**: Configuration is written straight to disk using the `{KEY}.cfg` (if `TEXT` based) and `{KEY}.yml` (if `YAML` based).<br/>📌 **disabled**: Straight up deny any read/write queries to the servers stateful store. Effectively turn off the Apprise Stateful feature completely.
| `SECRET_KEY` | A Django variable acting as a *salt* for most things that require security. This API uses it for the hash sequences when writing the configuration files to disk (`hash` mode only). | `SECRET_KEY` | A Django variable acting as a *salt* for most things that require security. This API uses it for the hash sequences when writing the configuration files to disk (`hash` mode only).
| `ALLOWED_HOSTS` | A list of strings representing the host/domain names that this API can serve. This is a security measure to prevent HTTP Host header attacks, which are possible even under many seemingly-safe web server configurations. By default this is set to `*` allowing any host. Use space to delimit more than one host. | `ALLOWED_HOSTS` | A list of strings representing the host/domain names that this API can serve. This is a security measure to prevent HTTP Host header attacks, which are possible even under many seemingly-safe web server configurations. By default this is set to `*` allowing any host. Use space to delimit more than one host.
| `BASE_URL` | Those who are hosting the API behind a proxy that requires a subpath to gain access to this API should specify this path here as well. By default this is not set at all.
| `DEBUG` | This defaults to `False` however can be set to `True` if defined with a non-zero value (such as `1`). | `DEBUG` | This defaults to `False` however can be set to `True` if defined with a non-zero value (such as `1`).

View File

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 Chris Caron <lead2gold@gmail.com>
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files(the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions :
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from .utils import ConfigCache
def stateful_mode(request):
"""
Returns our loaded Stateful Mode
"""
return {'STATEFUL_MODE': ConfigCache.mode}

View File

@ -40,10 +40,12 @@
<div class="row"> <div class="row">
<div class="col s3"> <div class="col s3">
{% if STATEFUL_MODE != 'disabled' %}
<ul class="collection z-depth-1"> <ul class="collection z-depth-1">
<a class="collection-item" href="{% url 'config' 'apprise' %}"><i class="tiny material-icons">settings</i> <a class="collection-item" href="{% url 'config' 'apprise' %}"><i class="tiny material-icons">settings</i>
{% trans "Configuration Manager" %}</a> {% trans "Configuration Manager" %}</a>
</ul> </ul>
{% endif %}
<ul class="collection z-depth-1"> <ul class="collection z-depth-1">
<a class="collection-item" target="_blank" <a class="collection-item" target="_blank"
href="https://github.com/caronc/apprise/wiki#notification-services">📣 href="https://github.com/caronc/apprise/wiki#notification-services">📣

View File

@ -1,6 +1,7 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load i18n %} {% load i18n %}
{% block body %} {% block body %}
{% if STATEFUL_MODE != 'disabled' %}
<h4>{% trans "Management for:" %} <em>{{ key }}</em></h4> <h4>{% trans "Management for:" %} <em>{{ key }}</em></h4>
<div class="row"> <div class="row">
<div class="col s12"> <div class="col s12">
@ -35,7 +36,7 @@
In the future you can return to this configuration screen at any time by placing the following into your In the future you can return to this configuration screen at any time by placing the following into your
browser: browser:
{% endblocktrans %} {% endblocktrans %}
<code>{{request.scheme}}://{{request.META.HTTP_HOST}}{{request.path}}</code> <code>{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/config/{{key}}</code>
</li> </li>
</ol> </ol>
</div> </div>
@ -56,7 +57,7 @@
send a test notification to all of your added services:{% endblocktrans %} send a test notification to all of your added services:{% endblocktrans %}
<br /> <br />
<pre><code class="bash">apprise --body="Test Message" --tag=all \<br/> <pre><code class="bash">apprise --body="Test Message" --tag=all \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;--config={{request.scheme}}://{{request.META.HTTP_HOST}}{% url "get" key %}</code></pre> &nbsp;&nbsp;&nbsp;&nbsp;--config={{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/get/{{key}}</code></pre>
</div> </div>
<div class="section"> <div class="section">
<h5>{% trans "Loaded Configuration" %}</h5> <h5>{% trans "Loaded Configuration" %}</h5>
@ -92,6 +93,12 @@
</p> </p>
</div> </div>
</div> </div>
{% else %}
<div class="section">
<h4>{% trans "Persistent Store Endpoints" %}</h4>
<p>{% blocktrans %}The administrator of this system has disabled persistent storage.{% endblocktrans %}</p>
</div>
{% endif %}
{% endblock %} {% endblock %}
{% block jsfooter %} {% block jsfooter %}

View File

@ -1,5 +1,6 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load i18n %} {% load i18n %}
{% block body %} {% block body %}
<h4>{% trans "The Apprise API" %}</h4> <h4>{% trans "The Apprise API" %}</h4>
<p> <p>
@ -31,7 +32,7 @@
<tbody> <tbody>
<tr> <tr>
<td><code>/notify/</code></td> <td><code>{{BASE_URL}}/notify/</code></td>
<td> <td>
{% blocktrans %}Used to notify one one or more specified Apprise URLs. See the <a target="_blank" {% blocktrans %}Used to notify one one or more specified Apprise URLs. See the <a target="_blank"
href="https://github.com/caronc/apprise/wiki#notification-services">Apprise Wiki</a> if you need help href="https://github.com/caronc/apprise/wiki#notification-services">Apprise Wiki</a> if you need help
@ -88,7 +89,7 @@
# {% blocktrans %}Notifies an email address{% endblocktrans %}<br/> # {% blocktrans %}Notifies an email address{% endblocktrans %}<br/>
curl -X POST -d '{"urls":"mailto://user:pass@gmail.com","body":"test body","title":"test title"}' \<br/> curl -X POST -d '{"urls":"mailto://user:pass@gmail.com","body":"test body","title":"test title"}' \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;-H "Content-Type: application/json" \<br/> &nbsp;&nbsp;&nbsp;&nbsp;-H "Content-Type: application/json" \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;http://localhost:8000/notify/</code></pre> &nbsp;&nbsp;&nbsp;&nbsp;{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/notify/</code></pre>
</div> </div>
</li> </li>
<li> <li>
@ -105,7 +106,7 @@
}<br/> }<br/>
<br/># The URL<br/> <br/># The URL<br/>
req = Request(<br/> req = Request(<br/>
&nbsp;&nbsp;&nbsp;&nbsp;"http://localhost:8000/notify/",<br/> &nbsp;&nbsp;&nbsp;&nbsp;"{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/notify/",<br/>
&nbsp;&nbsp;&nbsp;&nbsp;json.dumps(payload).encode('utf-8'),<br/> &nbsp;&nbsp;&nbsp;&nbsp;json.dumps(payload).encode('utf-8'),<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{"Content-Type": "application/json"},<br/> &nbsp;&nbsp;&nbsp;&nbsp;{"Content-Type": "application/json"},<br/>
&nbsp;&nbsp;&nbsp;&nbsp;method='POST',<br/> &nbsp;&nbsp;&nbsp;&nbsp;method='POST',<br/>
@ -119,7 +120,7 @@
<pre><code class="php">&lt;?php<br/> <pre><code class="php">&lt;?php<br/>
<br/> <br/>
// The URL<br/> // The URL<br/>
$url = 'http://localhost:8000/notify/';<br/> $url = '{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/notify/';<br/>
<br/> <br/>
//Initiate cURL.<br/> //Initiate cURL.<br/>
$ch = curl_init($url);<br/> $ch = curl_init($url);<br/>
@ -155,6 +156,7 @@
</tbody> </tbody>
</table> </table>
{% if STATEFUL_MODE != 'disabled' %}
<div class="section"> <div class="section">
<h4>{% trans "Persistent Store Endpoints" %}</h4> <h4>{% trans "Persistent Store Endpoints" %}</h4>
<p>{% blocktrans %}Those wishing to use the persistent store may do so. This section is a set it and forget it type <p>{% blocktrans %}Those wishing to use the persistent store may do so. This section is a set it and forget it type
@ -176,7 +178,7 @@
<tbody> <tbody>
<tr> <tr>
<td><code>/add/<em>{% trans "KEY" %}</em></code></td> <td><code>{{BASE_URL}}/add/<em>{% trans "KEY" %}</em></code></td>
<td> <td>
{% blocktrans %}Used to add a new Apprise configuration or a set of URLs and associates them with the {% blocktrans %}Used to add a new Apprise configuration or a set of URLs and associates them with the
specified <em>KEY</em>. See the <a target="_blank" specified <em>KEY</em>. See the <a target="_blank"
@ -233,12 +235,12 @@
# {% blocktrans %}Load a single URL and assign it to the <em>KEY</em> of abc123{% endblocktrans %}<br/> # {% blocktrans %}Load a single URL and assign it to the <em>KEY</em> of abc123{% endblocktrans %}<br/>
curl -X POST -d '{"urls":"mailto://user:pass@gmail.com"}' \<br/> curl -X POST -d '{"urls":"mailto://user:pass@gmail.com"}' \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;-H "Content-Type: application/json" \<br/> &nbsp;&nbsp;&nbsp;&nbsp;-H "Content-Type: application/json" \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;http://localhost:8000/add/<em>abc123</em></code></pre> &nbsp;&nbsp;&nbsp;&nbsp;{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/add/<em>abc123</em></code></pre>
<pre><code class="bash"> <pre><code class="bash">
# {% blocktrans %}Load a simple TEXT config entry <em>KEY</em> abc123{% endblocktrans %}<br/> # {% blocktrans %}Load a simple TEXT config entry <em>KEY</em> abc123{% endblocktrans %}<br/>
curl -X POST -d '{"format":"text","config":"devops=mailto://user:pass@gmail.com"}' \<br/> curl -X POST -d '{"format":"text","config":"devops=mailto://user:pass@gmail.com"}' \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;-H "Content-Type: application/json" \<br/> &nbsp;&nbsp;&nbsp;&nbsp;-H "Content-Type: application/json" \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;http://localhost:8000/add/abc123/ &nbsp;&nbsp;&nbsp;&nbsp;{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/add/abc123/
</code></pre> </code></pre>
</div> </div>
</li> </li>
@ -254,7 +256,7 @@
}<br/> }<br/>
<br/># The URL if the key was <em>abc123</em><br/> <br/># The URL if the key was <em>abc123</em><br/>
req = Request(<br/> req = Request(<br/>
&nbsp;&nbsp;&nbsp;&nbsp;"http://localhost:8000/add/<em>abc123</em>",<br/> &nbsp;&nbsp;&nbsp;&nbsp;"{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/add/<em>abc123</em>",<br/>
&nbsp;&nbsp;&nbsp;&nbsp;json.dumps(payload).encode('utf-8'),<br/> &nbsp;&nbsp;&nbsp;&nbsp;json.dumps(payload).encode('utf-8'),<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{"Content-Type": "application/json"},<br/> &nbsp;&nbsp;&nbsp;&nbsp;{"Content-Type": "application/json"},<br/>
&nbsp;&nbsp;&nbsp;&nbsp;method='POST',<br/> &nbsp;&nbsp;&nbsp;&nbsp;method='POST',<br/>
@ -268,7 +270,7 @@
<pre><code class="php">&lt;?php<br/> <pre><code class="php">&lt;?php<br/>
<br/> <br/>
// The URL if the key was <em>abc123</em><br/> // The URL if the key was <em>abc123</em><br/>
$url = 'http://localhost:8000/add/<em>abc123</em>';<br/> $url = '{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/add/<em>abc123</em>';<br/>
<br/> <br/>
//Initiate cURL.<br/> //Initiate cURL.<br/>
$ch = curl_init($url);<br/> $ch = curl_init($url);<br/>
@ -300,7 +302,7 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td><code>/del/<em>{% trans "KEY" %}</em></code></td> <td><code>{{BASE_URL}}/del/<em>{% trans "KEY" %}</em></code></td>
<td>{% blocktrans %}There are no arguments required. If the <em>KEY</em> exists and has data associated with <td>{% blocktrans %}There are no arguments required. If the <em>KEY</em> exists and has data associated with
it, it,
it will be removed.{% endblocktrans %} it will be removed.{% endblocktrans %}
@ -310,7 +312,7 @@
<div class="collapsible-body"> <div class="collapsible-body">
<pre><code class="bash"> <pre><code class="bash">
# {% blocktrans %}Remove previously loaded configuration associated with the <em>KEY</em> of abc123{% endblocktrans %}<br/> # {% blocktrans %}Remove previously loaded configuration associated with the <em>KEY</em> of abc123{% endblocktrans %}<br/>
curl -X POST http://localhost:8000/del/<em>abc123</em></code></pre> curl -X POST {{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/del/<em>abc123</em></code></pre>
</div> </div>
</li> </li>
<li> <li>
@ -321,7 +323,7 @@
from urllib.request import Request<br/> from urllib.request import Request<br/>
<br/># The request if the key was <em>abc123</em><br/> <br/># The request if the key was <em>abc123</em><br/>
req = Request(<br/> req = Request(<br/>
&nbsp;&nbsp;&nbsp;&nbsp;"http://localhost:8000/del/<em>abc123</em>",<br/> &nbsp;&nbsp;&nbsp;&nbsp;"{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/del/<em>abc123</em>",<br/>
&nbsp;&nbsp;&nbsp;&nbsp;json.dumps(payload).encode('utf-8'),<br/> &nbsp;&nbsp;&nbsp;&nbsp;json.dumps(payload).encode('utf-8'),<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{"Content-Type": "application/json"},<br/> &nbsp;&nbsp;&nbsp;&nbsp;{"Content-Type": "application/json"},<br/>
&nbsp;&nbsp;&nbsp;&nbsp;method='POST',<br/> &nbsp;&nbsp;&nbsp;&nbsp;method='POST',<br/>
@ -335,7 +337,7 @@
<pre><code class="php">&lt;?php<br/> <pre><code class="php">&lt;?php<br/>
<br/> <br/>
// The URL if the key was <em>abc123</em><br/> // The URL if the key was <em>abc123</em><br/>
$url = 'http://localhost:8000/del/<em>abc123</em>';<br/> $url = '{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/del/<em>abc123</em>';<br/>
<br/> <br/>
//Initiate cURL.<br/> //Initiate cURL.<br/>
$ch = curl_init($url);<br/> $ch = curl_init($url);<br/>
@ -352,16 +354,16 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td><code>/get/<em>{% trans "KEY" %}</em></code></td> <td><code>{{BASE_URL}}/get/<em>{% trans "KEY" %}</em></code></td>
<td>{% blocktrans %}This feature can be used by Apprise itself. It provides a means of remotely fetching it's <td>{% blocktrans %}This feature can be used by Apprise itself. It provides a means of remotely fetching it's
configuration.{% endblocktrans %}<br /> configuration.{% endblocktrans %}<br />
<pre><code lang="bash"># Use Apprise to retrieve your configuration:<br/> <pre><code lang="bash"># Use Apprise to retrieve your configuration:<br/>
apprise --body="test message" --config={{ request.scheme }}://{{request.META.HTTP_HOST}}{{ request.path }}<em>{% trans "KEY" %}</em></code></pre> apprise --body="test message" --config={{ request.scheme }}://{{request.META.HTTP_HOST}}{{BASE_URL}}/get/<em>{% trans "KEY" %}</em></code></pre>
</p> </p>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><code>/notify/<em>{% trans "KEY" %}</em></code></td> <td><code>{{BASE_URL}}/notify/<em>{% trans "KEY" %}</em></code></td>
<td>{% blocktrans %}Notifies the URLs associated with the specified <em>KEY</em>.{% endblocktrans %} <td>{% blocktrans %}Notifies the URLs associated with the specified <em>KEY</em>.{% endblocktrans %}
<div class="section"> <div class="section">
<table> <table>
@ -415,7 +417,7 @@
# {% blocktrans %}Notifies all URLs assigned the <em>devops</em> tag{% endblocktrans %}<br/> # {% blocktrans %}Notifies all URLs assigned the <em>devops</em> tag{% endblocktrans %}<br/>
curl -X POST -d '{"tag":"devops","body":"test body","title":"test title"}' \<br/> curl -X POST -d '{"tag":"devops","body":"test body","title":"test title"}' \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;-H "Content-Type: application/json" \<br/> &nbsp;&nbsp;&nbsp;&nbsp;-H "Content-Type: application/json" \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;http://localhost:8000/notify/<em>KEY</em></code></pre> &nbsp;&nbsp;&nbsp;&nbsp;{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/notify/<em>KEY</em></code></pre>
</div> </div>
</li> </li>
<li> <li>
@ -432,7 +434,7 @@
}<br/> }<br/>
<br/># The URL if the key was <em>abc123</em><br/> <br/># The URL if the key was <em>abc123</em><br/>
req = Request(<br/> req = Request(<br/>
&nbsp;&nbsp;&nbsp;&nbsp;"http://localhost:8000/notify/<em>abc123</em>",<br/> &nbsp;&nbsp;&nbsp;&nbsp;"{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/notify/<em>abc123</em>",<br/>
&nbsp;&nbsp;&nbsp;&nbsp;json.dumps(payload).encode('utf-8'),<br/> &nbsp;&nbsp;&nbsp;&nbsp;json.dumps(payload).encode('utf-8'),<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{"Content-Type": "application/json"},<br/> &nbsp;&nbsp;&nbsp;&nbsp;{"Content-Type": "application/json"},<br/>
&nbsp;&nbsp;&nbsp;&nbsp;method='POST',<br/> &nbsp;&nbsp;&nbsp;&nbsp;method='POST',<br/>
@ -446,7 +448,7 @@
<pre><code class="php">&lt;?php<br/> <pre><code class="php">&lt;?php<br/>
<br/> <br/>
// The URL if the key was <em>abc123</em><br/> // The URL if the key was <em>abc123</em><br/>
$url = 'http://localhost:8000/notify/<em>abc123</em>';<br/> $url = '{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/notify/<em>abc123</em>';<br/>
<br/> <br/>
//Initiate cURL.<br/> //Initiate cURL.<br/>
$ch = curl_init($url);<br/> $ch = curl_init($url);<br/>
@ -495,4 +497,10 @@
</p> </p>
</div> </div>
</div> </div>
{% else %}
<div class="section">
<h4>{% trans "Persistent Store Endpoints" %}</h4>
<p>{% blocktrans %}The administrator of this system has disabled persistent storage.{% endblocktrans %}</p>
</div>
{% endif %}
{% endblock %} {% endblock %}

View File

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 Chris Caron <lead2gold@gmail.com>
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files(the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions :
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from django.conf import settings
def base_url(request):
"""
Returns our defined BASE_URL object
"""
return {'BASE_URL': settings.BASE_URL}

View File

@ -70,6 +70,8 @@ TEMPLATES = [
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [
'django.template.context_processors.request', 'django.template.context_processors.request',
'core.context_processors.base_url',
'api.context_processors.stateful_mode',
], ],
}, },
}, },
@ -77,8 +79,12 @@ TEMPLATES = [
WSGI_APPLICATION = 'core.wsgi.application' WSGI_APPLICATION = 'core.wsgi.application'
# Define our base URL
# The default value is to be a single slash
BASE_URL = os.environ.get('BASE_URL', '')
# Static files relative path (CSS, JavaScript, Images) # Static files relative path (CSS, JavaScript, Images)
STATIC_URL = '/s/' STATIC_URL = BASE_URL + '/s/'
# The location to store Apprise configuration files # The location to store Apprise configuration files
APPRISE_CONFIG_DIR = os.environ.get( APPRISE_CONFIG_DIR = os.environ.get(