Custom APP Command?

How to define a command like bench XXXX on a specific site? I want to run a command to push some async celery task.

Specify site by adding the --site option

Eg :

bench --site <command>

thanks, but how to define a custom command?

You have to add to your app directory.

Have a look at how we’ve done it here :

import click
import frappe

click.disable_unicode_literals_warning = True

def make_purchase_receipt(po=None):
	print po

I put this file to APP/, but bench make_purchase_receipt didn’t work. still

Usage: bench [OPTIONS] COMMAND [ARGS]...

Error: No such command "make_purchase_receipt".

You don’t need to include every command in You can also execute a function by using bench --site <your_site_name> execute <method_with_its_path>


Nice! Got it! Thank YOU!