I have a very basic flask app with dependencies installed from my requirements.txt. All of these dependencies are installed in my virtual environment.
requirements.txt given below,
aniso8601==6.0.0
Click==7.0
Flask==1.0.3
Flask-Cors==3.0.7
Flask-RESTful==0.3.7
Flask-SQLAlchemy==2.4.0
itsdangerous==1.1.0
Jinja2==2.10.1
MarkupSafe==1.1.1
# psycopg2-binary==2.8.2
pytz==2019.1
six==1.12.0
# SQLAlchemy==1.3.4
Werkzeug==0.15.4
python-dotenv
requests
authlib
My code in NewTest.py file,
from flask import Flask, request, jsonify, abort, url_for
app = Flask(__name__)
@app.route('/')
def index():
return jsonify({
'success': True,
'index': 'Test Pass'
})
if __name__ == '__main__':
app.run(debug=True)
When I run the app through,
export FLASK_APP=NewTest.py
export FLASK_ENV=development
export FLASK_DEBUG=true
flask run
or flask run --reload
I get the following error,
127.0.0.1 - - [09/Feb/2020 12:43:40] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
File "/projects/env/lib/python3.8/site-packages/flask/_compat.py", line 36, i
n reraise
raise value
File "/projects/NewTest.py", line 3, in <module>
app = Flask(__name__)
File "/projects/env/lib/python3.8/site-packages/flask/app.py", line 559, in _
_init__
self.add_url_rule(
File "/projects/env/lib/python3.8/site-packages/flask/app.py", line 67, in wr
apper_func
return f(self, *args, **kwargs)
File "/projects/env/lib/python3.8/site-packages/flask/app.py", line 1217, in
add_url_rule
self.url_map.add(rule)
File "/projects/env/lib/python3.8/site-packages/werkzeug/routing.py", line 1388, in add
rule.bind(self)
File "/projects/env/lib/python3.8/site-packages/werkzeug/routing.py", line 730, in bind
self.compile()
File "/projects/env/lib/python3.8/site-packages/werkzeug/routing.py", line 794, in compile
self._build = self._compile_builder(False).__get__(self, None)
File "/projects/env/lib/python3.8/site-packages/werkzeug/routing.py", line 951, in _compile_builder
code = compile(module, "<werkzeug routing>", "exec")
TypeError: required field "type_ignores" missing from Module
Can anyone please point out what am I missing or doing wrong and how can I fix it? Thanks.
The bug was fixed in werkzeug 0.15.5. Upgrade from 0.15.4 to to a later version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With