fix: move uploads away from static files & fix company logo

This commit is contained in:
2026-09-14 21:12:33 +02:00
parent 1d25e49966
commit cc76207bb4
4 changed files with 15 additions and 4 deletions
+3 -1
View File
@@ -129,9 +129,11 @@ except Exception as e:
STATIC_URL = 'static/'
STATICFILES_DIRS = [
BASE_DIR / "static/",
BASE_DIR / "uploads/",
]
MEDIA_URL = "/uploads/"
MEDIA_ROOT = BASE_DIR / "uploads/"
# Email
# https://docs.djangoproject.com/en/6.1/topics/email/#topic-email-configuration
EMAIL_BACKEND = 'post_office.EmailBackend'
+1 -1
View File
@@ -90,7 +90,7 @@
{% for je in job_experiences %}
<li class="timeline-event">
<div class="timeline-event-icon bg-primary">
<img src="{{ je.company.logo.url }}" alt="">
<img src="{% url 'company-logo' pk=je.company.pk %}" alt="">
</div>
<div class="timeline-event-card card">
<div class="card-body">
+1
View File
@@ -6,4 +6,5 @@ urlpatterns = [
path("", views.PortfolioView.as_view(), name="portfolio"),
path("projects/", views.ProjectList.as_view(), name="projects"),
path("contact/", views.ContactSend.as_view(), name="contact"),
path("company/<int:pk>/logo/", views.CompanyLogo.as_view(), name="company-logo"),
]
+10 -2
View File
@@ -1,7 +1,7 @@
from django.conf import settings
from django.http.response import HttpResponseBadRequest
from django.http.response import FileResponse, HttpResponseBadRequest
from django.utils.translation import gettext as _
from django.views.generic import ListView, TemplateView
from django.views.generic import DetailView, ListView, TemplateView
from post_office import mail
from portfolio import forms, models
@@ -41,3 +41,11 @@ class ContactSend(TemplateView):
)
return super().get(request, *args, **kwargs)
class CompanyLogo(DetailView):
model = models.Company
def get(self, request, *args, **kwargs):
company = self.get_object()
return FileResponse(company.logo)