[solved] Instance ignoring debug-mode

I have one project of ours that uses our normal buildout structure (similar to https://github.com/plone/simple-plone-buildout), but I cannot get it to run in debug mode locally.

The [instance] has debug-mode = on, and even the zope.conf shows debug-mode on. I run the instance in the foreground, but Site Setup shows, "You are running in "production mode".", and I have to restart to see template changes.

I'm curious if anyone else has run into this, and could point me to something I might need to change.

What is in the end in your parts/instance/etc/zope.conf configured?

%define INSTANCEHOME /Users/chrissy/projects/x/parts/instance
instancehome $INSTANCEHOME
%define CLIENTHOME /Users/chrissy/projects/x/var/instance
clienthome $CLIENTHOME
debug-mode on
security-policy-implementation python
verbose-security on
default-zpublisher-encoding utf-8
    TZ America/New_York
PYTHON_EGG_CACHE /Users/chrissy/projects/x/var/.python-eggs
CHAMELEON_CACHE /Users/chrissy/projects/x/var/cache
<zodb_db main>
    # Main database
    cache-size 30000
    # Blob-enabled FileStorage database
      blob-dir /Users/chrissy/projects/x/var/blobstorage
      # FileStorage database
        path /Users/chrissy/projects/x/var/filestorage/Data.fs
    mount-point /
<zodb_db temporary>
    # Temporary storage database (for sessions)
      name temporary storage for sessioning
    mount-point /temp_folder
    container-class Products.TemporaryFolder.TemporaryContainer
python-check-interval 1000

are you running it with instance start or instance fg?


Could it be that you have something that restarts the site automatically (when it goes down).

I would go to http://someserver:port/manage_main and shut id down. Then I would see if it is still available, if not start it as bin/instance fg (or zeoserver) and check

A story of debugging

OK, so I rolled up my sleeves, made great use of my breakpoint() hammer, and dug deep into the code.

I initially avoided putting a breakpoint into Zope's App/config.py because I didn't want it to be triggered too many times. During startup, I could see that debug_mode was always set to True, but by the time I checked in Site Setup, it was 0.

I scoured the project's omelette for every occurrence of debug_mode, ignoring anything coming from tests (which do occasionally disable debug_mode).

So I eventually put that breakpoint into App/config.py(31)getConfiguration(), because no other function was telling me where the problem was actually coming from

There was a lot of:

(Pdb) _config.debug_mode
(Pdb) c

Until eventually, _config.debug_mode was 0!. Hitting w at the prompt provided a long traceback, but I quickly noticed where it was pointing at some of our custom code that did the following import:

from Testing.ZopeTestCase import utils as z2_utils

And of course, this code from ZopeTestCase does indeed disable debug mode. The commit message with the change was, "Prevent tile lookup from polluting the request". Now to figure out if I can safely remove it :smiley:

1 Like

Plone Foundation Code of Conduct