|
@@ -13,8 +13,8 @@ site_arg_optional = [] |
|
|
def main(): |
|
|
def main(): |
|
|
parsed_args = frappe._dict(vars(setup_parser())) |
|
|
parsed_args = frappe._dict(vars(setup_parser())) |
|
|
fn = get_function(parsed_args) |
|
|
fn = get_function(parsed_args) |
|
|
if not parsed_args.get("sites_path"): |
|
|
|
|
|
parsed_args["sites_path"] = "." |
|
|
|
|
|
|
|
|
parsed_args["sites_path"] = os.environ.get("SITES_DIR", ".") |
|
|
|
|
|
sites_path = parsed_args["sites_path"] |
|
|
|
|
|
|
|
|
if not parsed_args.get("make_app"): |
|
|
if not parsed_args.get("make_app"): |
|
|
|
|
|
|
|
@@ -22,13 +22,13 @@ def main(): |
|
|
for site in get_sites(parsed_args["sites_path"]): |
|
|
for site in get_sites(parsed_args["sites_path"]): |
|
|
args = parsed_args.copy() |
|
|
args = parsed_args.copy() |
|
|
args["site"] = site |
|
|
args["site"] = site |
|
|
frappe.init(site) |
|
|
|
|
|
|
|
|
frappe.init(site, sites_path=sites_path) |
|
|
run(fn, args) |
|
|
run(fn, args) |
|
|
else: |
|
|
else: |
|
|
if not fn in site_arg_optional: |
|
|
if not fn in site_arg_optional: |
|
|
if not parsed_args.get("site") and os.path.exists("currentsite.txt"): |
|
|
|
|
|
with open("currentsite.txt", "r") as sitefile: |
|
|
|
|
|
parsed_args["site"] = sitefile.read() |
|
|
|
|
|
|
|
|
if not parsed_args.get("site") and os.path.exists(os.path.join(sites_path, "currentsite.txt")): |
|
|
|
|
|
with open(os.path.join(sites_path, "currentsite.txt"), "r") as sitefile: |
|
|
|
|
|
parsed_args["site"] = sitefile.read().strip() |
|
|
|
|
|
|
|
|
site = parsed_args.get("site") |
|
|
site = parsed_args.get("site") |
|
|
|
|
|
|
|
@@ -36,11 +36,11 @@ def main(): |
|
|
print "Site argument required" |
|
|
print "Site argument required" |
|
|
exit(1) |
|
|
exit(1) |
|
|
|
|
|
|
|
|
if fn != 'install' and not os.path.exists(site): |
|
|
|
|
|
|
|
|
if fn != 'install' and not os.path.exists(os.path.join(parsed_args["sites_path"], site)): |
|
|
print "Did not find folder '{}'. Are you in sites folder?".format(parsed_args.get("site")) |
|
|
print "Did not find folder '{}'. Are you in sites folder?".format(parsed_args.get("site")) |
|
|
exit(1) |
|
|
exit(1) |
|
|
|
|
|
|
|
|
frappe.init(site) |
|
|
|
|
|
|
|
|
frappe.init(site, sites_path=parsed_args["sites_path"]) |
|
|
run(fn, parsed_args) |
|
|
run(fn, parsed_args) |
|
|
else: |
|
|
else: |
|
|
run(fn, parsed_args) |
|
|
run(fn, parsed_args) |
|
@@ -625,9 +625,9 @@ def run_tests(app=None, module=None, doctype=None, verbose=False): |
|
|
exit(1) |
|
|
exit(1) |
|
|
|
|
|
|
|
|
@cmd |
|
|
@cmd |
|
|
def serve(port=8000, profile=False): |
|
|
|
|
|
|
|
|
def serve(port=8000, profile=False, sites_path='.'): |
|
|
import frappe.app |
|
|
import frappe.app |
|
|
frappe.app.serve(port=port, profile=profile, site=frappe.local.site) |
|
|
|
|
|
|
|
|
frappe.app.serve(port=port, profile=profile, site=frappe.local.site, sites_path=sites_path) |
|
|
|
|
|
|
|
|
@cmd |
|
|
@cmd |
|
|
def request(args): |
|
|
def request(args): |
|
|