Thursday, January 10, 2013

Re: show an image in django

Have you tried removing {{ STATIC_URL }} and replacing it with a slash (/)? Or try appending the slash to the end of "E:/code/python/djangoBook/django-testapp-develop/static" in STATICFILES_DIRS.

You can also add DJANGO_ROOT = dirname(dirname(abspath(__file__))) to the top of your settings.py and then add this below it:


STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
    normpath(join(DJANGO_ROOT, 'static')),
)


That works for me in every project, although I don't use Windows, so it may be different in your case.

--
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.

No comments:

Post a Comment