Flaskシェルを使用して、Linux端末のpy / textファイルからPythonコマンドを実行します。

Flaskシェルを使用して、Linux端末のpy / textファイルからPythonコマンドを実行します。

Pythonに似たフラスコシェルを使用してPythonファイルを実行できますか?ように:

flask shell myfile.py

flask shell -f myfile.py

これが私が使用したときに得るすべてです$ flask shell --help

Usage: flask shell [OPTIONS]

  Runs an interactive Python shell in the context of a given Flask
  application.  The application will populate the default namespace of this
  shell according to it's configuration.

  This is useful for executing small snippets of management code without
  having to manually configure the application.

Options:
  --help  Show this message and exit.

次の変数を指定しました。

export FLASK_APP=run.py
export FLASK_ENV=development

ツールバージョン情報: - Linux 3.10 - Python 3.7.1 - Flask 1.0.2

ベストアンサー1

おすすめ記事