Ошибка Запуска Колбы Учебник: Приложение Flaskr

Есть небольшая проблема с запуском этого в моей командной строке (я уже в моем flaskrкаталоге).

set FLASK_APP=flaskr
set DEBUG_MODE=1
flask run

http://flask.pocoo.org/docs/0.11/tutorial/setup/#tutorial-setup

Я следил за всеми шагами до сих пор. Я читал о некоторых вещах с virtualenv и прочее, но это на самом деле не имеет смысла — я должен возиться с ним или есть легче исправить?

Мои выходные данные/журнал ошибок:

Traceback (most recent call last):
  File "c:usersdavidappdatalocalprogramspythonpython35-32librunpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "c:usersdavidappdatalocalprogramspythonpython35-32librunpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:UsersdavidAppDataLocalProgramsPythonPython35-32Scriptsflask.exe__main__.py", line 9, in <module>
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 478, in main
    cli.main(args=args, prog_name=name)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 345, in main
    return AppGroup.main(self, *args, **kwargs)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesclickcore.py", line 696, in main
    rv = self.invoke(ctx)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesclickcore.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesclickcore.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesclickcore.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesclickdecorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesclickcore.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 388, in run_command
    app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 124, in __init__
    self._load_unlocked()
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 148, in _load_unlocked
    self._app = rv = self.loader()
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 209, in load_app
    rv = locate_app(self.app_import_path)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 89, in locate_app
    __import__(module)
ImportError: No module named 'flaskr'

C:UsersdavidDocumentsSoftwareProjectsFlaskr>set FLASK_APP=flaskr

C:UsersdavidDocumentsSoftwareProjectsFlaskr>set DEBUG_MODE=1

C:UsersdavidDocumentsSoftwareProjectsFlaskr>flask run
Traceback (most recent call last):
  File "c:usersdavidappdatalocalprogramspythonpython35-32librunpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "c:usersdavidappdatalocalprogramspythonpython35-32librunpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:UsersdavidAppDataLocalProgramsPythonPython35-32Scriptsflask.exe__main__.py", line 9, in <module>
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 478, in main
    cli.main(args=args, prog_name=name)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 345, in main
    return AppGroup.main(self, *args, **kwargs)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesclickcore.py", line 696, in main
    rv = self.invoke(ctx)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesclickcore.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesclickcore.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesclickcore.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesclickdecorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesclickcore.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 388, in run_command
    app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 124, in __init__
    self._load_unlocked()
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 148, in _load_unlocked
    self._app = rv = self.loader()
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 209, in load_app
    rv = locate_app(self.app_import_path)
  File "c:usersdavidappdatalocalprogramspythonpython35-32libsite-packagesflaskcli.py", line 89, in locate_app
    __import__(module)
ImportError: No module named 'flaskr'

1 ответ

  1. Вам необходимо установить приложение как пакет на virtualenv или объявить расширение файла как FLASK_APP=flaskr.py