refactor(settings): update paths and command execution
Updated BASE_DIR and various paths in settings.py to simplify path handling. Modified management commands to use a consistent runner script (`quackscape-manage`) for improved clarity and maintainability. Addresses potential path issues and standardizes command usage.
This commit is contained in:
parent
d8f8ae30e3
commit
e7824d079a
|
@ -1,6 +1,7 @@
|
|||
import asyncio
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
@ -10,12 +11,12 @@ class Command(BaseCommand):
|
|||
|
||||
async def start_django(self):
|
||||
# Command to run the Django development server
|
||||
proc = await asyncio.create_subprocess_shell("python manage.py runserver")
|
||||
proc = await asyncio.create_subprocess_shell(f"quackscape-manage runserver")
|
||||
stdout, stderr = await proc.communicate()
|
||||
|
||||
async def start_celery(self):
|
||||
# Command to run the Celery worker
|
||||
proc = await asyncio.create_subprocess_shell("python manage.py runworker")
|
||||
proc = await asyncio.create_subprocess_shell(f"quackscape-manage runworker")
|
||||
stdout, stderr = await proc.communicate()
|
||||
|
||||
async def run_both(self):
|
||||
|
|
|
@ -6,7 +6,7 @@ from urllib.parse import urlparse
|
|||
from django.urls import reverse_lazy
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
BASE_DIR = Path(__file__).resolve().parent
|
||||
|
||||
ASK = AutoSecretKey("settings.ini")
|
||||
|
||||
|
@ -108,7 +108,7 @@ else:
|
|||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": BASE_DIR / "db.sqlite3",
|
||||
"NAME": "db.sqlite3",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,13 +159,13 @@ USE_TZ = True
|
|||
STATIC_URL = "static/"
|
||||
|
||||
STATICFILES_DIRS = [
|
||||
BASE_DIR / "static",
|
||||
"static",
|
||||
]
|
||||
|
||||
# Settings for uploaded files
|
||||
|
||||
MEDIA_URL = "/media/"
|
||||
MEDIA_ROOT = ASK.config.get("Quackscape", "MediaRoot", fallback=BASE_DIR / "media")
|
||||
MEDIA_ROOT = ASK.config.get("Quackscape", "MediaRoot", fallback="media")
|
||||
|
||||
if "S3" in ASK.config:
|
||||
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
|
||||
|
|
Loading…
Reference in a new issue