This is a React project but I want to just test the Flask environment for now.
My directories:
api
|app
|_py_cache
| .flaskenv
| api.py
|venv
api.py
import time
from flask import Flask
app = Flask(__name__)
@app.route('/time')
def get_current_time():
return {'time': time.time()}
.flaskenv
FLASK_APP=api.py
FLASK_ENV=development
package.json
"scripts": {
"start": "react-scripts start",
"start-api": "cd api && venv\\Scripts\\activate && cd app && flask run --no-debugger",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"proxy": "http://127.0.0.1:5000/"
After using flask run and going to the url, I get this error: flask.cli.NoAppException: Failed to find Flask application or factory in module "api". Use "FLASK_APP=api:name to specify one.