Changed folder structure

This commit is contained in:
Kristofers Solo 2023-06-28 10:20:18 +00:00
parent 6759ff4b58
commit 2686257910
47 changed files with 20 additions and 10 deletions

View File

@ -14,7 +14,7 @@ def get_profile_pic_path(instance, filename) -> Path:
class User(AbstractUser):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, verbose_name="ID")
profile_picture = models.ImageField(upload_to=get_profile_pic_path, default="profile_pics/default.jpg")
profile_picture = models.ImageField(upload_to=get_profile_pic_path, default="profile-pics/default.jpg")
@property
def full_name(self):

View File

@ -21,7 +21,7 @@ sys.path.insert(0, str(BASE_PATH.joinpath("FOSSDB", "apps")))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
with open(BASE_PATH.joinpath("config.json"), "r", encoding="UTF-8") as config_file:
with open(BASE_PATH.parent / "config.json", "r", encoding="UTF-8") as config_file:
config = json.load(config_file)
# SECURITY WARNING: keep the secret key used in production secret!
@ -61,7 +61,9 @@ ROOT_URLCONF = "FOSSDB.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [BASE_PATH.joinpath("templates")],
"DIRS": [
BASE_PATH / "templates",
],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
@ -128,10 +130,17 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/
STATIC_URL = "/static/"
STATIC_ROOT = BASE_PATH.joinpath("static")
MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_PATH.joinpath("media")
STATIC_URL = "static/"
STATICFILE_DIRS = [
BASE_PATH / "static",
]
STATIC_ROOT = BASE_PATH.parent / "local-cdn" / "static"
MEDIA_URL = "media/"
MEDIAFILES_DIRS = [
BASE_PATH / "media",
]
MEDIA_ROOT = BASE_PATH.parent / "local-cdn" / "media"
# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field

View File

@ -14,7 +14,6 @@ Including another URLconf
2. Add a URL to urlpatterns: path("blog/", include("blog.urls"))
"""
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
@ -24,6 +23,8 @@ urlpatterns = [
path("", include("account.urls")),
path("", include("django.contrib.auth.urls")),
]
if settings.DEBUG:
from django.conf.urls.static import static
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB