Skip to content
Snippets Groups Projects
Commit dab1a0d8 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

Use Pathlib

parent be367088
No related branches found
No related tags found
No related merge requests found
# Django settings for pv project.
import os
from pathlib import Path
from corsheaders.defaults import default_headers
# Paths
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
PROJECT_DIR = os.path.dirname(__file__)
LOCALE_PATHS = (BASE_DIR / "locale",)
LOCALE_PATHS = (os.path.join(PROJECT_DIR, "locale"),)
MEDIA_ROOT = os.path.join(PROJECT_DIR, "site_media")
MEDIA_ROOT = BASE_DIR / "site_media"
MEDIA_URL = "/site_media/"
STATIC_ROOT = os.path.join(PROJECT_DIR, "static")
STATIC_ROOT = BASE_DIR / "static"
STATIC_URL = "/static/"
ROOT_URLCONF = "steering.urls"
......@@ -47,7 +47,7 @@ if os.getenv("VIRTUAL_ENV"):
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(PROJECT_DIR, "db.sqlite3"),
"NAME": BASE_DIR / "db.sqlite3",
}
}
else:
......@@ -75,7 +75,7 @@ SECRET_KEY = os.getenv("SECRET_KEY", default="secret-key")
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [os.path.join(PROJECT_DIR, "templates")],
"DIRS": [BASE_DIR / "templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment