I have this code in app.py
and it works fine:
from flask import Flask, request, abort, jsonify
from functools import wraps
app = Flask(__name__)
@app.route('/test', methods=['POST'])
def hello():
return 'Hello'
Now, I added a subdirectory interface
under the directory where app.py
resides. In this subdirectory I added two files:
__init__.py
(empty), and
test2.py
with the following content:
from flask import Flask, request, abort, jsonify
from functools import wraps
app = Flask(__name__)
@app.route('/test2', methods=['POST'])
def hello2():
return 'Hello2'
If I try to access /test2
I get a 404 not found error. How to make Flask aware of test2
?