Re: How do I display a static image in my index.html file?
On 14/01/2013 2:18am, frocco wrote:
> I finally got this working.
>
> Why is it necessary to run collectstatic?
> in PHP, I would just point to the images.
Consider that you might have a number of apps in your project. As an
experienced Django dev you would probably keep your separate apps nicely
segregated so they can be re-used in multiple projects without any
integration overhead. That means the static files for such apps really
must stay with the apps - or management and deployment gets too hard.
So your project has a few apps and each has its own static files. When
you deploy all you need to do is add the app static dir to the
settings.STATICFILES_DIRS list and run collectstatic.
Apache or whatever webserver you use only needs a simple directive to
serve them from STATIC_ROOT.
It is very nice.
>
> Thanks for your help, I am really enjoying django.
>
> On Saturday, January 12, 2013 5:41:12 PM UTC-5, @jeffblack360 wrote:
>
> Directory structure please?
>
> FWIW, you have django.contrib.staticfiles defined twice.
>
> Did you read the howto doc on static files?
>
> @jeffblack360
>
> On Jan 12, 2013, at 2:17 PM, frocco <far...@gmail.com <javascript:>>
> wrote:
>
>>>
>> Page not found (404)
>>
>> Request Method: GET
>> Request URL: http://127.0.0.1:8000/static/img/auto.jpg
>> <http://127.0.0.1:8000/static/img/auto.jpg>
>>
>> Using the URLconf defined in |ntw.urls|, Django tried these
>> URL patterns, in this order:
>>
>> 1. ^staff/$
>> 2. ^static/img/$
>> 3. ^static/$
>> 4. ^admin/doc/
>> 5. ^admin/
>>
>> The current URL, |static/img/auto.jpg|, didn't match any of these.
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/3Qt8rkRKSrcJ
>> <https://groups.google.com/d/msg/django-users/-/3Qt8rkRKSrcJ>.
>> To post to this group, send email to django...@googlegroups.com
>> <javascript:>.
>> To unsubscribe from this group, send email to
>> django-users...@googlegroups.com <javascript:>.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en
>> <http://groups.google.com/group/django-users?hl=en>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/3UmqFDipFRQJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home