diff options
author | Filipp Lepalaan <filipp@mac.com> | 2016-11-02 21:00:04 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2016-11-02 21:00:04 +0200 |
commit | f525019dc1dab61ae19ec493796083ebed492dab (patch) | |
tree | d4427bf1db04ad58ee852782254a4148e134713d /servo | |
parent | d48a2d08b0afe33c89acb2b9f985266886a2114d (diff) | |
download | Servo-f525019dc1dab61ae19ec493796083ebed492dab.tar.gz Servo-f525019dc1dab61ae19ec493796083ebed492dab.tar.bz2 Servo-f525019dc1dab61ae19ec493796083ebed492dab.zip |
Added makers
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) |