refactor: reuse common scripts and files

move common scripts to build/common
This commit is contained in:
Revant Nandgaonkar
2020-02-20 18:01:23 +05:30
parent 347b94dee2
commit 242708df0c
41 changed files with 62 additions and 545 deletions

View File

@@ -0,0 +1,25 @@
import sys
import frappe
import IPython
from frappe.utils import get_sites
def console(site):
"Start ipython console for a site"
if site not in get_sites():
print("Site {0} does not exist on the current bench".format(site))
return
frappe.init(site=site)
frappe.connect()
frappe.local.lang = frappe.db.get_default("lang")
all_apps = frappe.get_installed_apps()
for app in all_apps:
locals()[app] = __import__(app)
print("Apps in this namespace:\n{}".format(", ".join(all_apps)))
IPython.embed(display_banner="", header="")
site = sys.argv[-1]
console(site)