If I serve my admin media directly from my Django app's Apache instance, my app will run slower and use more memory. So, what's the correct way to serve my admin media on WebFaction?

asked 19 Oct '10, 17:04

seanf's gravatar image

seanf ♦♦
8.0k1726
accept rate: 39%

edited 19 Oct '10, 19:06


We recommend that you use a static-only symlink application to serve your admin media - details are available in our Django documentation for serving admin media.

link

answered 19 Oct '10, 17:07

seanf's gravatar image

seanf ♦♦
8.0k1726
accept rate: 39%

I followed the docs http://docs.webfaction.com/software/django/getting-started.html#serving-admin-media , but I also needed to set an alias in httpd.conf: Alias /admin_media "/home/<user>/webapps/<app_name>/lib/python2.6/django/contrib/admin/media/" Is that correct? It works, but I don't know why. Could you explain that to me, please?

Thanks!

(20 Mar '11, 12:05) Sergio Rus Sergio%20Rus's gravatar image

Our docs set things up so that your media is served by our front-end webserver and not by your private Apache. If you followed the docs correctly, then you don't need to set up anything in httpd.conf.

If you take out your httpd.conf changes and then restart your Apache, what kind of response do you get when you try to access /admin_media/css/base.css on your domain?

(20 Mar '11, 12:15) seanf ♦♦ seanf's gravatar image

The response is: error 404. I commented the line and restarted apache.

This is my Webfaction config:

Apps (control panel)

Symbolic link to static-only app

name: sc_admin_media

extra info: /home/<user_name>/webapps/<app_name>/lib/python2.6/django/contrib/admin/media

Websites (control panel)

Site apps: sc_admin_media

URL path: /media/admin

(21 Mar '11, 07:40) Sergio Rus Sergio%20Rus's gravatar image

Try setting ADMIN_MEDIA_PREFIX in your settings.py to '/media/admin', then restart your Apache.

Also, check that the 'nginx' user has execute permission on your home directory.

If you want us to take a closer look at this, then please open a support ticket.

If you reply back here again, please use the 'add new comment' button below this comment, and not the "your answer" field (since you're not answering the original question).

(21 Mar '11, 08:47) seanf ♦♦ seanf's gravatar image
1

Sorry, but I think there is a bug with comments. I can't see the "add new comment" button: http://i.min.us/ijJa9W.png (firefox 3.6.13 @ Ubuntu linux 10.04)

OK It works! I set ADMIN_MEDIA_PREFIX to '/media/admin', removed the alias in httpd.conf and restarted Apache. I also set permissions to 750 on my home.

Thanks

(22 Mar '11, 05:00) Sergio Rus Sergio%20Rus's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×742
×36
×23

Asked: 19 Oct '10, 17:04

Seen: 2,684 times

Last updated: 22 Mar '11, 11:40

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited