aboutsummaryrefslogtreecommitdiffstats
path: root/servo/management
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2016-11-02 21:00:04 +0200
committerFilipp Lepalaan <filipp@mac.com>2016-11-02 21:00:04 +0200
commitf525019dc1dab61ae19ec493796083ebed492dab (patch)
treed4427bf1db04ad58ee852782254a4148e134713d /servo/management
parentd48a2d08b0afe33c89acb2b9f985266886a2114d (diff)
downloadServo-f525019dc1dab61ae19ec493796083ebed492dab.tar.gz
Servo-f525019dc1dab61ae19ec493796083ebed492dab.tar.bz2
Servo-f525019dc1dab61ae19ec493796083ebed492dab.zip
Added makers
Diffstat (limited to 'servo/management')
-rw-r--r--servo/management/commands/makedirs.py21
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)