|
1 | 1 | # Management Command to compile static Sass files |
2 | 2 | import os |
3 | | -import urllib.request |
4 | | -import urllib.error |
5 | 3 | from django.core.management.base import BaseCommand, CommandError |
6 | 4 | from decouple import config |
7 | 5 | from django.core.management import call_command |
@@ -36,21 +34,6 @@ def setup_theme_colors(colors): |
36 | 34 | return themes_colors |
37 | 35 |
|
38 | 36 |
|
39 | | -def setup_static_file(source, destination): |
40 | | - """ |
41 | | - Copies a static file from source to destination |
42 | | - :param source: the source file path(direct url) |
43 | | - :param destination: the destination file path |
44 | | - """ |
45 | | - |
46 | | - try: |
47 | | - urllib.request.urlretrieve(source, destination) |
48 | | - except urllib.error.HTTPError: |
49 | | - raise CommandError(f'Could not download {source}') |
50 | | - except urllib.error.URLError: |
51 | | - raise CommandError(f'Could not download {source}') |
52 | | - |
53 | | - |
54 | 37 | class Command(BaseCommand): |
55 | 38 | help = 'Compile static Sass files' |
56 | 39 |
|
@@ -79,12 +62,6 @@ def handle(self, *args, **options): |
79 | 62 | # writing the success message |
80 | 63 | self.stdout.write(self.style.SUCCESS('Successfully compiled static Sass files')) |
81 | 64 |
|
82 | | - # setup background image |
83 | | - image_source = config('BACKGROUND_IMAGE', default='https://physionet.org/static/images/background.jpg') |
84 | | - image_destination = 'static/images/background.jpg' |
85 | | - setup_static_file(image_source, image_destination) |
86 | | - self.stdout.write(self.style.SUCCESS('Successfully setup background image')) |
87 | | - |
88 | 65 | # Demo section for home.css |
89 | 66 | theme_generator(themes_colors, imports=['../../custom/scss/home']) |
90 | 67 | call_command('sass', 'static/bootstrap/scss/theme.scss', 'static/custom/css/home.css') |
0 commit comments