File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change
1
+ from pathlib import Path
2
+
3
+ from environs import Env
4
+
5
+ env = Env ()
6
+ env .read_env ()
7
+
8
+ BASE_DIR = Path (__file__ ).resolve ().parent
9
+
10
+ MEDIA_ROOT = env .path ("MEDIA_ROOT" )
11
+ MEDIA_ROOT .mkdir (exist_ok = True )
12
+
13
+ IMAGES_DIR = MEDIA_ROOT / "images"
14
+ IMAGES_DIR .mkdir (exist_ok = True )
15
+
16
+ SGF_DIR = MEDIA_ROOT / "sgf"
17
+ SGF_DIR .mkdir (exist_ok = True )
18
+
19
+ FIREBASE_CREDENTIALS_FILE = BASE_DIR / env .str ("FIREBASE_CREDENTIALS_FILE" )
Original file line number Diff line number Diff line change 1
1
import io
2
- import os
3
2
from pathlib import Path
4
3
5
4
import firebase_admin
6
5
from celery import Celery
7
- from django .conf import settings
8
6
from firebase_admin import credentials , messaging
9
7
8
+ import settings
10
9
from sgf .process_image import process_image
11
10
12
- # Set the default Django settings module for the 'celery' program.
13
- os .environ .setdefault ("DJANGO_SETTINGS_MODULE" , "go_capture.settings" )
14
-
15
11
app = Celery ("go_capture" )
16
12
17
13
# Using a string here means the worker doesn't have to serialize
18
14
# the configuration object to child processes.
19
15
# - namespace='CELERY' means all celery-related configuration keys
20
16
# should have a `CELERY_` prefix.
21
- app .config_from_object ("django.conf: settings" , namespace = "CELERY" )
17
+ app .config_from_object ("settings" , namespace = "CELERY" )
22
18
23
19
# Load task modules from all registered Django apps.
24
20
app .autodiscover_tasks ()
You can’t perform that action at this time.
0 commit comments