forked from GithubBackups/healthchecks
Show a warning when running with DEBUG=True. Fixes #189
This commit is contained in:
parent
5ef67e8bbf
commit
0ece2664ac
@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
|
||||
- Add search box in the "My Checks" page
|
||||
- Add read-only API key support
|
||||
- Remove Profile.bill_to field (obsolete)
|
||||
- Show a warning when running with DEBUG=True
|
||||
|
||||
### Bug Fixes
|
||||
- During DST transition, handle ambiguous dates as pre-transition
|
||||
|
@ -35,6 +35,18 @@ def site_root():
|
||||
return settings.SITE_ROOT
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def debug_warning():
|
||||
if settings.DEBUG:
|
||||
return mark_safe("""
|
||||
<div id="debug-warning">
|
||||
Running in debug mode, do not use in production.
|
||||
</div>
|
||||
""")
|
||||
|
||||
return ""
|
||||
|
||||
|
||||
def naturalize_int_match(match):
|
||||
return '%08d' % (int(match.group(0)),)
|
||||
|
||||
|
@ -1,14 +1,18 @@
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from hc.api.models import Check
|
||||
|
||||
|
||||
class BasicsTestCase(TestCase):
|
||||
|
||||
def test_it_shows_welcome(self):
|
||||
r = self.client.get("/")
|
||||
self.assertContains(r, "Get Notified", status_code=200)
|
||||
self.assertNotContains(r, "do not use in production")
|
||||
|
||||
@override_settings(DEBUG=True)
|
||||
def test_it_shows_debug_warning(self):
|
||||
r = self.client.get("/")
|
||||
self.assertContains(r, "do not use in production")
|
||||
|
||||
@override_settings(REGISTRATION_OPEN=False)
|
||||
def test_it_obeys_registration_open(self):
|
||||
|
@ -93,3 +93,10 @@ pre {
|
||||
.jumbotron p {
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
#debug-warning {
|
||||
background: #eeeeee;
|
||||
text-align: center;
|
||||
font-size: small;
|
||||
padding: 2px 0;
|
||||
}
|
@ -46,6 +46,7 @@
|
||||
{% endcompress %}
|
||||
</head>
|
||||
<body class="page-{{ page }}">
|
||||
{% debug_warning %}
|
||||
<nav class="navbar navbar-default">
|
||||
<div class="container{% if page == "checks" or page == "details" %}-fluid{% endif %}">
|
||||
<div class="navbar-header">
|
||||
|
Loading…
x
Reference in New Issue
Block a user