flask-cli

Where should I implement flask custom commands (cli)

瘦欲@ 提交于 2019-12-24 01:01:40
问题 Creating custom commands in flask needs access to the app, which is generally created in app.py like this: import click from flask import Flask app = Flask(__name__) @app.cli.command("create-user") @click.argument("name") def create_user(name): ... However, in order not to bloat my app.py, I want to put my custom commands in a separate file e.g. commands.py , but this doesn't work because the entrypoint to my project is app.py , so I'll have to import app in commands.py and import my commands

Run Flask CLI command with PyCharm debugger

99封情书 提交于 2019-12-11 06:59:30
问题 I have created a custom CLI command in Flask, that I am able to run via flask my_command in the terminal. I want to run this command using PyCharm's debugger. I created a "Flask server" configuration, and running it with the PyCharm debugger stops at breakpoints I set inside view functions. But if I try to run my CLI command from PyCharm's terminal, it doesn't stop at breakpoints in the command. Do I need a custom configuration to debug custom CLI commands? I found a question about Django

Run Flask CLI command with PyCharm debugger

邮差的信 提交于 2019-11-27 09:36:06
I have created a custom CLI command in Flask, that I am able to run via flask my_command in the terminal. I want to run this command using PyCharm's debugger. I created a "Flask server" configuration, and running it with the PyCharm debugger stops at breakpoints I set inside view functions. But if I try to run my CLI command from PyCharm's terminal, it doesn't stop at breakpoints in the command. Do I need a custom configuration to debug custom CLI commands? I found a question about Django commands, but PyCharm's "Flask server" configuration doesn't have the same options. How can I configure

Run Flask CLI command with PyCharm debugger

╄→гoц情女王★ 提交于 2019-11-26 11:33:59
问题 I have created a custom CLI command in Flask, that I am able to run via flask my_command in the terminal. I want to run this command using PyCharm\'s debugger. I created a \"Flask server\" configuration, and running it with the PyCharm debugger stops at breakpoints I set inside view functions. But if I try to run my CLI command from PyCharm\'s terminal, it doesn\'t stop at breakpoints in the command. Do I need a custom configuration to debug custom CLI commands? I found a question about