​When deploying a Django project with DEBUG = False, static files are not 
served automatically by Django. To handle static files in production, you 
can use *WhiteNoise*. After installing WhiteNoise, add 
'whitenoise.middleware.WhiteNoiseMiddleware' to your MIDDLEWARE settings 
and set STATICFILES_STORAGE to 
'whitenoise.storage.CompressedManifestStaticFilesStorage'. Then, run python 
manage.py collectstatic to collect all static files into the directory 
specified by STATIC_ROOT. This setup enables WhiteNoise to serve your 
static files efficiently in a production.
On Monday, 31 March 2025 at 1:14:32 am UTC+5:30 Szawunia wrote:

> Hi everybody,
> I have problem with my static files in my Django project, running local. 
> Actually Django-Oscar, but settings files is Django.  There are not founded 
> (404 error). I have all my static files in my project directory (where 
> 'manage.py' is).
> My settings:
>
> STATIC_URL = 'static/'
>
> STATIC_ROOT = BASE_DIR / 'static'
>
> In my templates:
>
> {% load static %}
>
> <link href="{% static "main.css" %}" rel="stylesheet">
>
> <link rel="shortcut icon" href="{% static "logo3.gif" %}" />
>
> I stuck with that problem. Earlier in my Django simple project, all was 
> ok. So my settings should be right. 
>
> Any help will be appreaciate. Or any idea how to check, in simple way, 
> what is wrong with my static loading
>
> With all the best 
>
>
> Ewa
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/django-users/ba691a4c-c066-4521-8e71-95fc8ed7c1cen%40googlegroups.com.

Reply via email to