From 12382d5205fa3ba38f0dad8df8e4fc266ba01f29 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Fri, 13 Jul 2018 15:51:04 -0700 Subject: move settings to file, fix error if no banned_addresses.txt --- settings.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 settings.py (limited to 'settings.py') diff --git a/settings.py b/settings.py new file mode 100644 index 0000000..499b32b --- /dev/null +++ b/settings.py @@ -0,0 +1,11 @@ +default_settings = '''route_tor = False +port_number = 80 +allow_foreign_addresses = False +''' +exec(default_settings) +try: + with open('settings.txt', 'r', encoding='utf-8') as file: + exec(file.read()) +except FileNotFoundError: + with open('settings.txt', 'a', encoding='utf-8') as file: + file.write(default_settings) \ No newline at end of file -- cgit v1.2.3