Django on Webfaction: Serving static admin media files - configuration
I having trouble serving Django's static admin files on webfaction.
Here's how I'm currently set up:
I've created a 'Symbolic link to static-only app', and provided the link to Django admin files in 'extra info':
/home/myusername/webapps/mydjangoapp/lib/python2.5/django/contrib/admin/media
(cd'ing into t开发者_StackOverflowhat directory works fine)I've added this app to my django website, and specified
/media
as the URL path.In my django settings,
ADMIN_MEDIA_PREFIX = '/media/'
(my static files are prefixed with /static/, so there's no conflict here)In the source code of an admin page, I can see that admin media is correctly linked, e.g.
<link rel="stylesheet" type="text/css" href="/media/css/base.css" />
However, following the link I get a 404 page (from nginx).
I've played around with this forever now, so any ideas what might be wrong here, or any recommendations on how to troubleshoot this would be really appreciated!
I think you're missing a trailing slash on the "Symbol link to static-only app", it should be:
/home/myusername/webapps/mydjangoapp/lib/python2.5/django/contrib/admin/media/
(or at least, that's what works for me at Webfaction).
If that doesn't work - ask them, they've got really the most helpful support team of any hosting company I've used ever.
In your second point URL path entry would be /media/admin
as you can see in webfaction-docs.
Their support is really good when you open a ticket or post a question in their django forums :)
精彩评论