diff --git a/CHANGELOG.md b/CHANGELOG.md index 7778576124..9a607c34f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ without arguments starts a full interactive Python console. Attributes instead of `[None]`. - Remove `pillow` requirement (install especially if using imagefield) - Add Simplified Korean translation (user aceamro) +- Show warning on `start -l` if settings contains values unsafe for production. ## Evennia 0.9 (2018-2019) diff --git a/evennia/server/deprecations.py b/evennia/server/deprecations.py index 976040a8e9..d51f3e753d 100644 --- a/evennia/server/deprecations.py +++ b/evennia/server/deprecations.py @@ -85,7 +85,12 @@ def check_errors(settings): def check_warnings(settings): """ - Check deprecations that should produce warnings but which + Check conditions and deprecations that should produce warnings but which does not stop launch. """ - pass + if settings.DEBUG: + print(" [Devel: settings.DEBUG is True. Important to turn off in production.]") + if settings.IN_GAME_ERRORS: + print(" [Devel: settings.IN_GAME_ERRORS is True. Turn off in production.]") + if settings.ALLOWED_HOSTS == ["*"]: + print(" [Devel: settings.ALLOWED_HOSTS set to '*' (all). Limit in production.]") diff --git a/evennia/server/evennia_launcher.py b/evennia/server/evennia_launcher.py index 86dd99aa43..ad73bd26a0 100644 --- a/evennia/server/evennia_launcher.py +++ b/evennia/server/evennia_launcher.py @@ -242,7 +242,7 @@ ERROR_DATABASE = \ (error was '{traceback}') If you think your database should work, make sure you are running your - commands from inside your game directory. If this error persists, run + commands from inside your game directory. If this error persists, run evennia migrate @@ -1611,7 +1611,7 @@ def show_version_info(about=False): django=django.get_version()) -def error_check_python_modules(): +def error_check_python_modules(show_warnings=False): """ Import settings modules in settings. This will raise exceptions on pure python-syntax issues which are hard to catch gracefully with @@ -1619,6 +1619,9 @@ def error_check_python_modules(): python source files themselves). Best they fail already here before we get any further. + Kwargs: + show_warnings (bool): If non-fatal warning messages should be shown. + """ from django.conf import settings @@ -1634,11 +1637,13 @@ def error_check_python_modules(): from evennia.server import deprecations try: deprecations.check_errors(settings) - deprecations.check_warnings(settings) except DeprecationWarning as err: print(err) sys.exit() + if show_warnings: + deprecations.check_warnings(settings) + # core modules _imp(settings.COMMAND_PARSER) _imp(settings.SEARCH_AT_RESULT) @@ -2113,11 +2118,11 @@ def main(): query_info() elif option == "start": init_game_directory(CURRENT_DIR, check_db=True) - error_check_python_modules() + error_check_python_modules(show_warnings=args.tail_log) start_evennia(args.profiler, args.profiler) elif option == "istart": init_game_directory(CURRENT_DIR, check_db=True) - error_check_python_modules() + error_check_python_modules(show_warnings=args.tail_log) start_server_interactive() elif option == "ipstart": start_portal_interactive()