diff options
Diffstat (limited to 'servo')
-rw-r--r-- | servo/management/commands/makedirs.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/servo/management/commands/makedirs.py b/servo/management/commands/makedirs.py new file mode 100644 index 0000000..2718f5f --- /dev/null +++ b/servo/management/commands/makedirs.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- + +import os +import logging +from django.conf import settings +from django.core.management.base import BaseCommand + + +class Command(BaseCommand): + def handle(self, *args, **options): + help = "Create necessary upload directories" + dirs = ['attachments', 'devices', 'logos', + 'products', 'repairs', 'return_labels', + 'settings', 'temp', 'templates'] + + for d in dirs: + fp = os.path.join(settings.MEDIA_ROOT, d) + try: + os.mkdir(fp) + except OSError as e: + logging.warning(e) |