static files

36 views
Skip to first unread message

Dariusz Mysior

unread,
Sep 3, 2014, 2:01:26 PM9/3/14
to django...@googlegroups.com
I have my path like below:

home > darmys > dom > player > templates > access > index.html

and code

div>{% load staticfiles %}<img src="{% static "player/images/pilka.jpg" %}" alt="Piłka"/></div>

path to image is


home > darmys > dom > player > static > images

In my site I see not image but only alt text why? :/

Collin Anderson

unread,
Sep 3, 2014, 5:32:42 PM9/3/14
to django...@googlegroups.com
it should be relative do your /static/ directory like so:

{% static "images/pilka.jpg" %}

Tom Evans

unread,
Sep 4, 2014, 9:22:24 AM9/4/14
to django...@googlegroups.com
On Wed, Sep 3, 2014 at 10:32 PM, Collin Anderson <cmawe...@gmail.com> wrote:
> it should be relative do your /static/ directory like so:
>
> {% static "images/pilka.jpg" %}
>

Alternatively, it is good to include the app name in the static path,
so it might be better to move the file to
/home/daymys/dom/player/static/player/images, and keep it as "{%
static "player/images/pilka.jpg" %}".

Cheers

Tom

Dariusz Mysior

unread,
Sep 4, 2014, 12:57:10 PM9/4/14
to django...@googlegroups.com
I dont't understand

Now I have like You said and it's not work. I try with app name and without.

Dariusz Mysior

unread,
Sep 4, 2014, 2:00:21 PM9/4/14
to django...@googlegroups.com
Ok I set it :)


W dniu środa, 3 września 2014 20:01:26 UTC+2 użytkownik Dariusz Mysior napisał:
Reply all
Reply to author
Forward
0 new messages