Mercurial > kallithea
annotate docs/usage/debugging.rst @ 7846:d68b77e4e4ab
tg2: move routing mapper initialization from RootController class definition time to instantiation time
Things happened to work before, despite unfortunate code executation at import
time. TurboGears 2.4 changed something, so actual serving works, but pytest
fails with:
collecting ...
...
data/env/lib/python2.7/site-packages/_pytest/config/__init__.py:463: in _importconftest
raise ConftestImportFailure(conftestpath, sys.exc_info())
E ConftestImportFailure: (local('.../kallithea/tests/conftest.py'), (<type 'exceptions.KeyError'>, KeyError('paths',), <traceback object at 0x7fb6679030e0>))
or more useful, if raising the real exception instead of obfuscating with ConftestImportFailure:
...
kallithea/tests/conftest.py:15: in <module>
from kallithea.controllers.root import RootController
kallithea/controllers/root.py:29: in <module>
class RootController(RoutedController, BaseController):
kallithea/controllers/root.py:31: in RootController
mapper = make_map(config)
kallithea/config/routing.py:32: in make_map
rmap = Mapper(directory=config['paths']['controllers'],
data/env/lib/python2.7/site-packages/tg/configuration/tgconfig.py:28: in __getitem__
return self.config_proxy.current_conf()[key]
E KeyError: 'paths'
_importconftest <_pytest.config.PytestPluginManager object at 0x7f20c770a3d0> .../conftest.py
In this example, in RootController, the global config object is at this time just:
{'debug': False, 'package': None, 'i18n.lang': None, 'tg.strict_tmpl_context': True, 'tg.app_globals': None}
Solved by moving the mapper initialization to __init__.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Wed, 28 Aug 2019 12:07:37 +0200 |
parents | 87ac42db389c |
children |
rev | line source |
---|---|
2119
4d076981a7b1
docs about debugging
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
1 .. _debugging: |
4d076981a7b1
docs about debugging
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
2 |
4d076981a7b1
docs about debugging
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
3 =================== |
4192
e73a69cb98dc
Rename some strings examples and commands in documentation
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3224
diff
changeset
|
4 Debugging Kallithea |
2119
4d076981a7b1
docs about debugging
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
5 =================== |
4d076981a7b1
docs about debugging
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
6 |
4955
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
7 If you encounter problems with Kallithea, here are some instructions |
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
8 on how to debug them. |
2119
4d076981a7b1
docs about debugging
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
9 |
4955
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
10 .. note:: First make sure you're using the latest version available. |
2119
4d076981a7b1
docs about debugging
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
11 |
5433
fbbe80e3322b
docs: consistent spacing around headings
Mads Kiilerich <madski@unity3d.com>
parents:
4955
diff
changeset
|
12 |
4902 | 13 Enable detailed debug |
2119
4d076981a7b1
docs about debugging
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
14 --------------------- |
4d076981a7b1
docs about debugging
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
15 |
4955
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
16 Kallithea uses the standard Python ``logging`` module to log its output. |
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
17 By default only loggers with ``INFO`` level are displayed. To enable full output |
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
18 change ``level = DEBUG`` for all logging handlers in the currently used .ini file. |
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
19 This change will allow you to see much more detailed output in the log file or |
2125
097327aaf2ad
more detailed logging on auth system
Marcin Kuzminski <marcin@python-works.com>
parents:
2119
diff
changeset
|
20 console. This generally helps a lot to track issues. |
2119
4d076981a7b1
docs about debugging
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
21 |
4d076981a7b1
docs about debugging
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
22 |
4902 | 23 Enable interactive debug mode |
2119
4d076981a7b1
docs about debugging
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
24 ----------------------------- |
4d076981a7b1
docs about debugging
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
25 |
4955
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
26 To enable interactive debug mode simply comment out ``set debug = false`` in |
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
27 the .ini file. This will trigger an interactive debugger each time |
5854 | 28 there is an error in the browser, or send a http link if an error occurred in the backend. This |
4955
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
29 is a great tool for fast debugging as you get a handy Python console right |
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
30 in the web view. |
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
31 |
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
32 .. warning:: NEVER ENABLE THIS ON PRODUCTION! The interactive console |
4e6dfdb3fa01
docs: English and consistency corrections
Michael V. DePalatis <mike@depalatis.net>
parents:
4902
diff
changeset
|
33 can be a serious security threat to your system. |