5

I'm truly uncertain how I got into this mode, but when I start my flask application on the development system, I see

2016-11-17 17:20:36,717 WARNING: * Debugger is active!

but there is no display of the debugging PIN and I don't see the requests which come in to the server.

When this started happening I poked around a bit to try to see what change I made to cause this, but was too embroiled in making the application work to follow up at the time. Of course any history is long gone.

Do you have any suggestions on how to debug this?

In case it matters, I'm running on windows.

I dumped app.config using

        configkeys = app.config.keys()
        configkeys.sort()
        appconfig = []
        for key in configkeys:
            value = app.config[key]
            if not owner_permission.can():
                if key in ['SQLALCHEMY_DATABASE_URI','SECRET_KEY']:
                    value = '<obscured>'
            appconfig.append({'label':key, 'value':value})
        sysvars.append(['app.config',appconfig])

(later display of sysvars in html template) and see the following. I also tried setting debug=True in the run() invocation but no effect.

APPLICATION_ROOT / DEBUG True EXPLAIN_TEMPLATE_LOADING False JSONIFY_MIMETYPE application/json JSONIFY_PRETTYPRINT_REGULAR True JSON_AS_ASCII True JSON_SORT_KEYS True LOGGER_HANDLER_POLICY always LOGGER_NAME rrwebapp LOGGING_LEVEL_FILE 20 LOGGING_LEVEL_MAIL 40 LOGGING_MAIL_HANDLER <logging.handlers.SMTPHandler object at 0x03806630> LOGGING_PATH C:\\Users\\Lou\\Documents\\Lou's Software\\projects\\rrwebapp\\rrwebapp.log MAX_CONTENT_LENGTH None MINIMIZE_CDN_JAVASCRIPT False PERMANENT_SESSION_LIFETIME 31 days, 0:00:00 PREFERRED_URL_SCHEME http PRESERVE_CONTEXT_ON_EXCEPTION None PROPAGATE_EXCEPTIONS None SECRET_KEY flask development key SEND_FILE_MAX_AGE_DEFAULT 12:00:00 SERVER_NAME None SESSION_COOKIE_DOMAIN None SESSION_COOKIE_HTTPONLY True SESSION_COOKIE_NAME session SESSION_COOKIE_PATH None SESSION_COOKIE_SECURE False SESSION_REFRESH_EACH_REQUEST True SQLALCHEMY_BINDS None SQLALCHEMY_COMMIT_ON_TEARDOWN False SQLALCHEMY_DATABASE_URI mysql://rrwebuser:xxxxxxxxx@127.0.0.1/testnewracedb SQLALCHEMY_ECHO False SQLALCHEMY_MAX_OVERFLOW None SQLALCHEMY_NATIVE_UNICODE None SQLALCHEMY_POOL_RECYCLE None SQLALCHEMY_POOL_SIZE None SQLALCHEMY_POOL_TIMEOUT None SQLALCHEMY_RECORD_QUERIES None SQLALCHEMY_TRACK_MODIFICATIONS False TEMPLATES_AUTO_RELOAD None TESTING False TRAP_BAD_REQUEST_ERRORS False TRAP_HTTP_EXCEPTIONS False USE_X_SENDFILE False

12/27/16 adding requirements.txt

alembic==0.8.8
amqp==1.4.9
anyjson==0.3.3
appdirs==1.4.0
attrdict==2.0.0
billiard==3.3.0.23
blinker==1.4
celery==3.1.23
click==6.6
docutils==0.11
docx==0.2.4
ecdsa==0.13
ez-setup==0.9
Fabric==1.11.1
Flask==0.11.1
Flask-Login==0.3.2
Flask-Principal==0.4.0
Flask-SQLAlchemy==2.1
Flask-Uploads==0.2.1
Flask-WTF==0.12
flup==1.0.2
googlemaps==2.4.4
gpxpy==1.1.2
haversine==0.4.5
httplib2==0.9.2
ipython==1.1.0
itsdangerous==0.24
Jinja2==2.8
kombu==3.0.35
loutilities==0.11.0
lxml==3.6.0
Mako==1.0.4
MarkupSafe==0.23
mysql-python==1.2.5
oauthlib==2.0.0
paramiko==1.17.0
Pillow==3.2.0
pycrypto==2.6.1
pyreadline==2.0
python-editor==1.0.1
pytz==2013.9
requests==2.10.0
requests-oauthlib==0.7.0
running==1.4.0
six==1.10.0
SQLAlchemy==1.0.15
sqlalchemy-datatables===0.4.1lk3
tzlocal==1.0
unicodecsv==0.14.1
Werkzeug==0.11.11
WTForms==2.1
xlrd==0.9.2
xlwt==0.7.5
Lou K
  • 1,128
  • 2
  • 12
  • 31
  • can you add your *requirements.txt* or output of `pip freeze`? depending on which version of flask you are using, you might not see the debugger pin. a few releases ago that wasn't a thing. – wgwz Dec 27 '16 at 15:31
  • done. I was seeing debugger pin and I'm not sure what change I made but it disappeared, I think along with the request outputs – Lou K Dec 27 '16 at 17:20
  • see here (just in case you missed something): http://stackoverflow.com/questions/17309889. and if the config values you listed are environment variables, try: `FLASK_DEBUG=true` instead. – wgwz Dec 27 '16 at 17:28
  • Pretty sure I looked at that question, and the values I list are a dump of app.config so I'm sure the debug flag is set. Also note I see "2016-11-17 17:20:36,717 WARNING: * Debugger is active!" but no pin. – Lou K Dec 27 '16 at 17:37
  • I also tried poking through the flask code but was unable to find where the PIN is set and displayed to try to figure out what conditions need to be met. If you know the code maybe you have some guidance? – Lou K Dec 27 '16 at 17:47
  • Hmm, not sure why I didn't find this before, but tried poking around werkzeug , searched for 'debugger is active' and see message, but don't quite understand why I don't see additional message after that. Looks like either I should see DEBUGGER UNSECURED or debugger pin code. Ref werkzeug.__init__ line 253 [version 0.11.11] – Lou K Dec 27 '16 at 18:05
  • how are you setting your config? environment variables, config file? the pin stuff is in werkzeug starting a 0.11 which you have, so that should not be the issue. – wgwz Dec 27 '16 at 19:57
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/131628/discussion-between-lou-k-and-wgwz). – Lou K Dec 27 '16 at 21:36

1 Answers1

5

Problem turned out to be that log level was set incorrectly when werkzeug started, causing info messages to be obscured. Needs further debug but this is clearly a problem with my app initialization.

Adding following code to my initialization takes care of the problem.

# patch werkzeug logging -- not sure why this is being bypassed in werkzeug._internal._log
werkzeug_logger = logging.getLogger('werkzeug')
werkzeug_logger.setLevel(logging.INFO)

UPDATE 5/8/2019: Per Jorge Mendes comment, WERKZEUG_DEBUG_PIN can be used to set a specific pin as alternate fix

Lou K
  • 1,128
  • 2
  • 12
  • 31