mirror of
https://github.com/django-components/django-components.git
synced 2025-09-26 23:49:07 +00:00
fix: raise command error if path
or BASE_DIR
not available
This commit is contained in:
parent
4f4b81b7a0
commit
ba436c0080
1 changed files with 9 additions and 4 deletions
|
@ -61,14 +61,19 @@ class Command(BaseCommand):
|
||||||
js_filename = kwargs["js"]
|
js_filename = kwargs["js"]
|
||||||
css_filename = kwargs["css"]
|
css_filename = kwargs["css"]
|
||||||
template_filename = kwargs["template"]
|
template_filename = kwargs["template"]
|
||||||
base_dir = settings.BASE_DIR
|
base_dir = getattr(settings, "BASE_DIR", None)
|
||||||
force = kwargs["force"]
|
force = kwargs["force"]
|
||||||
verbose = kwargs["verbose"]
|
verbose = kwargs["verbose"]
|
||||||
dry_run = kwargs["dry_run"]
|
dry_run = kwargs["dry_run"]
|
||||||
|
|
||||||
component_path = os.path.join(
|
if path:
|
||||||
path or f"{base_dir}/components", name
|
component_path = os.path.join(path, name)
|
||||||
)
|
elif base_dir:
|
||||||
|
component_path = os.path.join(base_dir, "components", name)
|
||||||
|
else:
|
||||||
|
raise CommandError(
|
||||||
|
"You must specify a path or set BASE_DIR in your django settings"
|
||||||
|
)
|
||||||
|
|
||||||
if os.path.exists(component_path):
|
if os.path.exists(component_path):
|
||||||
if force:
|
if force:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue