Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flask application starts without giving debugging pin, also no request info displayed

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:[email protected]/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
like image 864
Lou K Avatar asked Nov 17 '16 22:11

Lou K


1 Answers

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

like image 83
Lou K Avatar answered Sep 19 '22 13:09

Lou K