support setting DJANGO_PROJECT_FOLDER via --project-root-path

settings file can be located in a subdirectory of the project
This commit is contained in:
Victor Seva authored and David Wobrock committed 2019-07-10 10:20:14 +02:00
1 parent 83850fa3da
commit c0d33dd579
2 files changed
+11 -4

No files matched your search

@@ -46,6 +46,9 @@ class Command(BaseCommand):
"Defaults to default"
),
)
parser.add_argument(
"--project-root-path", type=str, nargs="?", help="django project root path"
)
cache_group = parser.add_mutually_exclusive_group(required=False)
cache_group.add_argument(
@@ -86,9 +89,12 @@ class Command(BaseCommand):
)
def handle(self, *args, **options):
settings_path = os.path.dirname(
import_module(os.getenv("DJANGO_SETTINGS_MODULE")).__file__
)
if options["project_root_path"]:
settings_path = options["project_root_path"]
else:
settings_path = os.path.dirname(
import_module(os.getenv("DJANGO_SETTINGS_MODULE")).__file__
)
if options["verbosity"] > 1:
logging.basicConfig(format="%(message)s", level=logging.DEBUG)