Re: trying to use a variable inside a static content tag

2019-07-27 Thread Sipum Mishra
Hi Lyman,

PFB.

Configure the following setting in your setting.py

STATIC_ROOT = os.path.join(BASE_DIR,"static_files")
STATIC_URL = '/static/'

STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),)

load *staticfiles* tag to template

{% load staticfiles %}

and then use in *src* attribute of *img HTML tag as you did. *


On Sun, 28 Jul, 2019, 4:37 AM Sithembewena L. Dube, 
wrote:

> Interesting.
>
> Kind regards,
> Lloyd
>
>
> *Sent with Shift
> *
>
> On Sat, Jul 27, 2019 at 11:25 PM Lyman Hurd  wrote:
>
>> A helpful user in the Python #django slack channel showed me this answer:
>>
>>
>> https://stackoverflow.com/questions/16655851/django-1-5-how-to-use-variables-inside-static-tag
>>
>>
>> On Saturday, July 20, 2019 at 4:31:52 AM UTC-7, Lyman Hurd wrote:
>>>
>>> Greetings.  I am writing a card game and I can load an image when I give
>>> a fixed value such as:
>>>
>>> >> style="width:69px;height:106px;">
>>>
>>> but I would actually like part o fthis to be determined by a tag (there
>>> is a for loop setting values) but when I write:
>>>
>>> >> style="width:69px;height:106px;">
>>>
>>> however when this is rendered into HTML the tag {{ card }} ha sbeen
>>> URL-escaped:
>>>
>>> 
>>>
>>> How can I render a static image based on the contents of a tag?
>>>
>>>
>>> Cheers,
>>>
>>> Lyman Hurd
>>>
>>>
>>> --
>> 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 on the web visit
>> https://groups.google.com/d/msgid/django-users/6706118e-f64a-4c6d-8bc6-c558d48640f5%40googlegroups.com
>> 
>> .
>>
> --
> 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 on the web visit
> https://groups.google.com/d/msgid/django-users/CAH-SnCCtH6%3DP6rzezAk1ErTaFnhYyVmBNj82wGN4osw%3DPeEdFA%40mail.gmail.com
> 
> .
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/CAGHZBzwSf04Cao6xzYumTZWOoDqqEUF7J4moHGHx3tkU0SQVSQ%40mail.gmail.com.


Re: trying to use a variable inside a static content tag

2019-07-27 Thread Sithembewena L. Dube
Interesting.

Kind regards,
Lloyd


*Sent with Shift
*

On Sat, Jul 27, 2019 at 11:25 PM Lyman Hurd  wrote:

> A helpful user in the Python #django slack channel showed me this answer:
>
>
> https://stackoverflow.com/questions/16655851/django-1-5-how-to-use-variables-inside-static-tag
>
>
> On Saturday, July 20, 2019 at 4:31:52 AM UTC-7, Lyman Hurd wrote:
>>
>> Greetings.  I am writing a card game and I can load an image when I give
>> a fixed value such as:
>>
>> > style="width:69px;height:106px;">
>>
>> but I would actually like part o fthis to be determined by a tag (there
>> is a for loop setting values) but when I write:
>>
>> > style="width:69px;height:106px;">
>>
>> however when this is rendered into HTML the tag {{ card }} ha sbeen
>> URL-escaped:
>>
>> 
>>
>> How can I render a static image based on the contents of a tag?
>>
>>
>> Cheers,
>>
>> Lyman Hurd
>>
>>
>> --
> 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 on the web visit
> https://groups.google.com/d/msgid/django-users/6706118e-f64a-4c6d-8bc6-c558d48640f5%40googlegroups.com
> 
> .
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/CAH-SnCCtH6%3DP6rzezAk1ErTaFnhYyVmBNj82wGN4osw%3DPeEdFA%40mail.gmail.com.


Re: trying to use a variable inside a static content tag

2019-07-27 Thread Lyman Hurd
A helpful user in the Python #django slack channel showed me this answer:

https://stackoverflow.com/questions/16655851/django-1-5-how-to-use-variables-inside-static-tag


On Saturday, July 20, 2019 at 4:31:52 AM UTC-7, Lyman Hurd wrote:
>
> Greetings.  I am writing a card game and I can load an image when I give a 
> fixed value such as:
>
>  style="width:69px;height:106px;">
>
> but I would actually like part o fthis to be determined by a tag (there is 
> a for loop setting values) but when I write:
>
>  style="width:69px;height:106px;">
>
> however when this is rendered into HTML the tag {{ card }} ha sbeen 
> URL-escaped:
>
> 
>
> How can I render a static image based on the contents of a tag?
>
>
> Cheers,
>
> Lyman Hurd
>
>
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/6706118e-f64a-4c6d-8bc6-c558d48640f5%40googlegroups.com.