Django Static Files

19 views
Skip to first unread message

Kevin Anthony

unread,
Jun 24, 2011, 11:56:15 PM6/24/11
to Django users
I'm having a problem setting up my django static files,
my static files root is at:
/var/www/mysite/static/
here's my alias info
AliasMatch ^/([^/]*\.css) /var/www/mysite/static/$1
<Directory /var/www/mysite/static>
Order deny,allow
Allow from all
</Directory>

This is from my settings.py
STATIC_ROOT = '/var/www/mysite/static/'
STATIC_URL = '/static/'

and here is from base.html
<link type="text/css" rel="stylesheet" href="{% get_static_prefix %}
style.css"></link>
which resolves to this on the website
<link type="text/css" rel="stylesheet" href="/static/style.css"></
link>

except it 404's from access log
***.***.***.*** - - [24/Jun/2011:23:53:45 -0400] "GET /static/
style.css HTTP/1.1" 404 1322 "http://***.***.***.***/" "Mozilla/5.0
(X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Ubuntu/11.04
Chromium/12.0.742.91 Chrome/12.0.742.91 Safari/534.30"

I'm sure i'm missing something stupid, but i can't figure out why it
won't serve with apache
When I serve it using python manage 0.0.0.0:80 the css doesn't 404

Can someone please help me?

Thanks
Kevin Anthony

Andrew Brookins

unread,
Jun 25, 2011, 12:46:31 AM6/25/11
to django...@googlegroups.com
If django srrvd

Andrew Brookins

unread,
Jun 25, 2011, 12:53:49 AM6/25/11
to django...@googlegroups.com
Sorry: posting from phones... Not always awesome.

If the development server serves your static files, but Apache does not, then the problem is likely somewhere in your Apache conf or server config.

Kevin Anthony

unread,
Jun 25, 2011, 12:02:14 PM6/25/11
to django...@googlegroups.com

I sort of knew that....
Can someone post their scrubed conf file?

On Jun 25, 2011 12:54 AM, "Andrew Brookins" <a.m.br...@gmail.com> wrote:
> Sorry: posting from phones... Not always awesome.
>
> If the development server serves your static files, but Apache does not, then the problem is likely somewhere in your Apache conf or server config.
>
> --
> 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/-/oOT5Kiyo5JcJ.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
Reply all
Reply to author
Forward
0 new messages