-
Notifications
You must be signed in to change notification settings - Fork 151
Initialize Flask debug variable to the correct setting #75
Conversation
Hmm, we've gone back and forth on this in the past. It had been set to that but that meant it ignored your app.config value. We then set it to read from your app.config first, then fallback to the but then Flask started defaulting this value to False, which meant we'd never use the Not sure how best to proceed after the change in Flask to always have app.config.debug set to False |
The problem is that there is a discrepancy in the defaults for debugging. Flask defaults to False, while Flask-Script defaults to True. So who wins? My opinion is that if you are using Flask-Script then it should have precedence over Flask, so I think it would be all right to always override Flask's setting like I did in my patch. The other solution would be for Flask-Script to set its default for debugging to False, like Flask. But this would mean a change in behavior, now you would need to add the "-d" option to get the debugger, which at least for me would be inconvenient, as most of the time I want to run with the debugger. |
Flask-Script doesn't default debugging to false, it just enables the Werkzeug debugger by default. I agree if you're using Flask-Script's Server you are developing and therefore debugging most of the time, but you still need the ability to on occasion run the server without the debug flag (testing using production minified/compiled assets, enabling using production database vs local, etc). The think the proper solution is for the end user to set |
I'm not sure I agree. I think what you are basically saying is that Flask-Script should not mess with the debug configuration, the setting should come from configuration. I guess that is a valid solution, but that doesn't seem to be what Flask-Script documents. It seems before Flask 0.10 there were three cases for Flask Script to handle:
Is this a correct interpretation of how things worked before Flask defaulted its debug setting to The problem that we have now is that item 3 in my list cannot be determined anymore, that case looks exactly like 2 now. My understanding of the current issue is that item 1 in my list works the same as before, but for items 2 and 3 Flask-Script will end up leaving Flask's debug setting to If your choice is to let the user deal with this, then shouldn't you also leave |
Those 3 cases were true until pull request #54 6 months ago. Note: "-d" never affect's Flask or Werkzeug's "debug" setting now, after that pull request change, it only affect's the Werkzeug interactive debugger, so the last part of item 1 is not correct (about Flask's debug being turned off). What
but if the user overrides the default Server command with their own instance which disables the interactive debugger by default
I think some confusion of |
But is there any purpose to enabling Werkzeug's interactive debugger while Flask's debug setting is It seems to me the only valid case where the developer needs to mess with settings is when you want to run Flask in debug mode without the interactive debugger. In that case you set |
Ok, I think you've finally won me over. I'll be honest, my free time has been pretty limited the past 6+ months and doesn't look to be getting any better. I'm considering looking for a new maintainer for this extension so it can get the attention it deserves. I was hoping a Flask Github organization would be created (pallets/flask#729) and move it under there, but it doesn't appear to be getting any traction. Would you consider helping maintain this extension? Since we've moved to using Argparse's subparsers there are some third party script compatibility issues that really need resolved (I've hit a few roadblocks while investigating myself) and could use a fresh view on it. |
Initialize Flask debug variable to the correct setting
Thanks! I'll look at the Flask-Assets issue and let you know if I can come up with something. I'm happy to help out, I don't have a lot of time myself, but I do have some. |
Thanks |
I thought on this some more and think maybe we should change
The user can still disable use_debugger, but must to globally when registing a Server instance with Flask-Script. Does this seem to allow for all use cases you can think of? |
I like it. That brings back the ability for the user to set |
The debug state in Flask is never changed, only Werkzeug gets set with the correct debug state. Because if that the debugger is not activated.