debubpy + autoreload not working with FlaskForm
morindo opened this issue · 1 comments
Greetings, I'm not sure if this issue is related to debugpy or FlaskForm implementation but here's the problem.
I'm using VS Code + debugpy extension to debug my Flask/Python code and I've also activated the autoReload feature to enable code reload. When I debug my Flask app there is no problem when I change code and refresh my page, it takes all the changes without the need to restart my app. But when I change a FlaskForm, the code is not autoReload and I get the following message in my VS Code (Python Debugger) Debug Console saying that debugpy was not able to reload the code due to a NoneType class.
VS Code Debug Console
code reload: Start reloading module: "app.routes.pages.strategies.forms" ...
code reload: Type of: _unbound_fields (old: <class 'list'> != new: <class 'NoneType'>) changed... Skipping.
code reload: Type of: _wtforms_meta (old: <class 'type'> != new: <class 'NoneType'>) changed... Skipping.
code reload: reload finished without applying any change
forms.py
from flask_wtf import FlaskForm
from wtforms import (
StringField,
)
from wtforms.validators import DataRequired, Length
class StrategyForm(FlaskForm):
name = StringField(
"Name",
validators=[DataRequired(), Length(min=3, max=40)],
render_kw={"placeholder": "Strategy Name"},
)
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Flask",
"type": "debugpy",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "app",
"FLASK_DEBUG": "1",
"FLASK_ENV": "development"
},
"autoReload": {
"enable": true
},
"args": [
"run",
"--no-debugger",
"--no-reload"
],
"jinja": true,
"justMyCode": true
}
]
}
Is this issue related to debugpy or FlaskForm?
Thank you very very much!
Environment data
- debugpy version: 1.8.2
- OS and version: Windows 11
- Python version (& distribution if applicable, e.g. Anaconda): Python 3.1
- Using VS Code or Visual Studio: VS Code
- Flask-WTF version: 1.2.1
- Flask version: 3.0.3
Expected behavior
I think that VS Code should be able to auto reload changes when a FlaskForm is modified and saved.