django staticfiles problem

94 views
Skip to first unread message

Chelsea Fan

unread,
Oct 14, 2020, 6:43:25 AM10/14/20
to django...@googlegroups.com
hello everyone, I have an issue, I can't connect css style to my template, but I can upload images and see it , here is my code,  please help me, thanks  for attentions !!!

STATIC_URL = '/static/'
STATICFILES_DIR = [BASE_DIR / 'static']
{% load static %}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="{% static '/css/base.css' %}">
image.png

Anh Nguyen

unread,
Oct 14, 2020, 7:13:28 AM10/14/20
to django...@googlegroups.com
where is your STATIC_ROOT ?


--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJwZndd_SYaToM%3D6h1KL-WmXs7eR3e0sgwHqVPPFwo%3Dx2HW5xg%40mail.gmail.com.

Chelsea Fan

unread,
Oct 14, 2020, 11:06:51 AM10/14/20
to django...@googlegroups.com
MEDIA_URL = '/images/'
MEDIA_ROOT = BASE_DIR / 'static/images'

Farai M

unread,
Oct 15, 2020, 1:05:19 AM10/15/20
to django...@googlegroups.com
Why have the media url if it's point to the same dir as static .Your can just specific it's separately in it's own dir as /media/ and have /static/ .You are also missing a static root there .

Luis Zárate

unread,
Oct 15, 2020, 2:58:41 PM10/15/20
to django...@googlegroups.com
You have a problem here
{% static '/css/base.css' %}

the correct is
    {% static 'css/base.css' %}

Also is a bad idea set media folder in static.






--
"La utopía sirve para caminar" Fernando Birri


Chelsea Fan

unread,
Oct 15, 2020, 3:16:20 PM10/15/20
to django...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages