Running the flask application prompt could not find the module

the environment variable has been set and the initialization file has been created, why is it still prompted that the module cannot be found?

(Flask-Practice) ydx@ydx-PC:$ ls
app  config  config.py  instance  LICENSE.md  README.md  requirements.txt
(Flask-Practice) ydx@ydx-PC:$ ls app
auth.py  database.py  forms.py  __init__.py  login.py  __pycache__  scheme.sql  static  templates  views
(Flask-Practice) ydx@ydx-PC:$ echo $FLASK_APP
app
(Flask-Practice) ydx@ydx-PC:$ flask run
Traceback (most recent call last):
  File "/opt/python-env/Flask-Practice/bin/flask", line 11, in <module>
    sys.exit(main())
  File "/opt/python-env/Flask-Practice/lib/python3.6/site-packages/flask/cli.py", line 478, in main
    cli.main(args=args, prog_name=name)
  File "/opt/python-env/Flask-Practice/lib/python3.6/site-packages/flask/cli.py", line 345, in main
    return AppGroup.main(self, *args, **kwargs)
  File "/opt/python-env/Flask-Practice/lib/python3.6/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/opt/python-env/Flask-Practice/lib/python3.6/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/python-env/Flask-Practice/lib/python3.6/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/python-env/Flask-Practice/lib/python3.6/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/opt/python-env/Flask-Practice/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/opt/python-env/Flask-Practice/lib/python3.6/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/opt/python-env/Flask-Practice/lib/python3.6/site-packages/flask/cli.py", line 388, in run_command
    app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
  File "/opt/python-env/Flask-Practice/lib/python3.6/site-packages/flask/cli.py", line 124, in __init__
    self._load_unlocked()
  File "/opt/python-env/Flask-Practice/lib/python3.6/site-packages/flask/cli.py", line 148, in _load_unlocked
    self._app = rv = self.loader()
  File "/opt/python-env/Flask-Practice/lib/python3.6/site-packages/flask/cli.py", line 209, in load_app
    rv = locate_app(self.app_import_path)
  File "/opt/python-env/Flask-Practice/lib/python3.6/site-packages/flask/cli.py", line 89, in locate_app
    __import__(module)
ModuleNotFoundError: No module named "app"

exit the virtual environment to create Flask applications normally:

(Flask-Practice) ydx@ydx-PC:$ deactivate
ydx@ydx-PC:$ ls
app  config  config.py  instance  LICENSE.md  README.md  requirements.txt
ydx@ydx-PC:$ flask run
 * Serving Flask app "app" (lazy loading)
 * Environment: development
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 146-573-781
127.0.0.1 - - [11/Jul/2018 00:34:08] "GET /hello HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/opt/anaconda3/lib/python3.6/site-packages/flask/cli.py", line 76, in find_best_app
    app = call_factory(script_info, app_factory)
  File "/opt/anaconda3/lib/python3.6/site-packages/flask/cli.py", line 116, in call_factory
    return app_factory()
  File "/home/ydx/Documents/Project/Python-Flask-Practice/app/__init__.py", line 27, in create_app
    from . import database
  File "/home/ydx/Documents/Project/Python-Flask-Practice/app/database.py", line 2, in <module>
    from flask_sqlalchemy import SQLAlchemy
ModuleNotFoundError: No module named "flask_sqlalchemy"
127.0.0.1 - - [11/Jul/2018 00:34:08] "GET /hello?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
127.0.0.1 - - [11/Jul/2018 00:34:08] "GET /hello?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 -
127.0.0.1 - - [11/Jul/2018 00:34:08] "GET /hello?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
127.0.0.1 - - [11/Jul/2018 00:34:08] "GET /hello?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.1" 200 -
127.0.0.1 - - [11/Jul/2018 00:34:08] "GET /hello?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
127.0.0.1 - - [11/Jul/2018 00:34:08] "GET /hello?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
Mar.25,2021

clipboard.png

you define run.py . Change hello to run .

< hr >

I just saw that the subject of the question should be Linux.

use echo $FLASK_APP to check that the environment variable is set correctly.


reinstall flask, to solve the problem.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e55fad-4402f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e55fad-4402f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?