Re: Missing trailing slash on static files

21 views
Skip to first unread message

Bill Freeman

unread,
May 14, 2013, 10:23:39 AM5/14/13
to django-users
Have you tried adding a slash at the end of STATIC_URL ?


On Tue, May 14, 2013 at 10:00 AM, Marc'h <mhoe...@gmail.com> wrote:
My mistake, the slash is missing between the static and images path components and not, as I erroneously wrote, between the app and static ones. Sorry for that.

Le mardi 14 mai 2013 15:52:39 UTC+2, Marc'h a écrit :
Hi all,

I'm having trouble configuring Django to serve static files for deployed apps (using Apache + WSGI).

Briefly put :

- the root URL of the Django application is http://www.example.com/app

- the root directory (SITE_ROOT) of the Django project is /var/www/html/django/app/app (yes indeed, two final app directories)

- inside the Django templates, references to static content is made through the static tag as in {% static 'images/logo.png' %}

- the actual file is thus located in : /var/www/html/django/app/app/static/images/logo.png

- the settings configuring the static directories are : 

STATIC_ROOT=os.path.join(SITE_ROOT,'static')
STATIC_URL='/app/static'
STATICFILES_DIRS=(
  STATIC_ROOT,
)


When a static resource is addressed from within a template, the generated URL is correct, as in http://www.example.com/app/static/images/logo.png
However, the mapping of this URL to a filename, as logged by the Apache error_log, yields : /var/www/html/django/app/app/staticimages/logo.png. There definitely is a slash missing between the app and static path components,
and the file is thus not found.

I've been reading through the various docs relative to static file serving, but haven't found anything related to this issue. If anyone out there has a clue as why the slash is stripped of, I'd be grateful to read a solution to this problem.

Many thanks in advance,

Marc'h



--
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 post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages