mirror of
https://github.com/evennia/evennia.git
synced 2026-03-24 00:36:30 +01:00
Show warnings on start -l if settings contains production-unsafe values. Resolves #1732
This commit is contained in:
parent
35a8282db0
commit
541a6fa855
3 changed files with 18 additions and 7 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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.]")
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue