First time here? Check out the FAQ!

Revision history  [back]

images and stylesheets not found

Django 1.4.5
Postgres 9.2
Apache/mod_wsgi
askbot-devel (cloned from github)
DEBUG = True

When I test things with runserver, everything looks great. However, using the base example from the docs to try and get apache to serve the site, none of the images or stylesheets are found. The page otherwise loads fine.

The following is shown in the logs:

[21/May/2013:14:55:41 -0400] "GET /m/default/media/style/style.css?v=1 HTTP/1.1" 404 21420
[21/May/2013:14:55:41 -0400] "GET /m/default/media/js/modernizr.custom.js?v=1 HTTP/1.1" 404 21441
[21/May/2013:14:55:41 -0400] "GET /m/default/media/bootstrap/css/bootstrap.css?v=1 HTTP/1.1" 404 21456
[21/May/2013:14:55:41 -0400] "GET /m/default/media/js/jquery-1.7.2.min.js?v=1 HTTP/1.1" 404 21441
[21/May/2013:14:55:41 -0400] "GET /m/default/media/bootstrap/js/bootstrap.js?v=1 HTTP/1.1" 404 21450
[21/May/2013:14:55:41 -0400] "GET /m/default/media/js/jquery.history.js?v=1 HTTP/1.1" 404 21435
[21/May/2013:14:55:41 -0400] "GET /m/default/media/js/utils.js?v=1 HTTP/1.1" 404 21408
[21/May/2013:14:55:41 -0400] "GET /m/default/media/js/live_search.js?v=1 HTTP/1.1" 404 21426
[21/May/2013:14:55:41 -0400] "GET /m/default/media/js/editor.js?v=1 HTTP/1.1" 404 21411
[21/May/2013:14:55:41 -0400] "GET /m/default/media/images/cc-by-sa.png?v=1 HTTP/1.1" 404 21432
[21/May/2013:14:55:41 -0400] "GET /m/default/media/js/tag_selector.js?v=1 HTTP/1.1" 404 21429
[21/May/2013:14:55:42 -0400] "GET /m/default/media/images/favicon.gif?v=1 HTTP/1.1" 404 21429

I saw the similar Question 8453 which has an answer for adding an additional 2 lines to alias the /m/ urls, so I tried that (pointing to my virtualenv and repo fork respectively) and it didn't work because /askbot/skins/ has no static media in it.

$ ls /home/user/askbot-devel/askbot/skins/
__init__.py  __init__.pyc  loaders.py  loaders.pyc  README  utils.py  utils.pyc

I finally hardcoded default in the alias and edited those two apache conf lines to read:

 Alias /m/admin/ /home/user/.virtualenvs/askbot/lib/python2.6/site-packages/django/contrib/admin/media/
 Alias /m/default/ /home/user/downloads/askbot-devel/askbot/

That doesn't feel right to me hardcoding the default in there even though everything now works. What is that alias supposed to be pointing to exactly?