forked from denigma/denigma
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.py
More file actions
32 lines (22 loc) · 925 Bytes
/
debug.py
File metadata and controls
32 lines (22 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /user/bin/env python
"""Toggles debug modus on server."""
local_settings = "/home/denigma/denigma/local_settings.py"
# Recieve settings and change debug values:
input = open(local_settings, 'r').read()
data = []
for line in input.split('\n'):
if line.startswith("DEBUG"):
value = not eval(line.split('DEBUG = ')[1])
data.append('DEBUG = %s' % value)
elif line.startswith("TEMPLATE_DEBUG"):
value = not eval(line.split('TEMPLATE_DEBUG = ')[1])
data.append('TEMPLATE_DEBUG = %s' % value)
elif line.startswith("SERVE_MEDIA"):
value = not eval(line.split('SERVE_MEDIA = ')[1])
data.append("SERVE_MEDIA = %s" % value)
else:
data.append(line)
# Sets settings:
print '\n'.join(data)
output = open(local_settings, 'w').writelines('\n'.join(data))
#234567891123456789212345678931234567894123456789512345678961234567897123456789