First time here? Check out the FAQ!
1

Where Location of Admin Media on Nginx?

Hello,

I have installed Askbot with Nginx but while I use for production site, CSS and image not loaded. I have followed instruction on http://askbot.org/en/question/677/location-of-media-folder and http://askbot.org/en/question/3138/location-of-media-folder but not correct.

Whatever page is work but only when I access Django Administration is not work.

This is some information of my AskBot site:

1) Askbot forum folder = /home/mysite/forum --> Work fine

2) Location /m/ = /usr/lib/python2.6/site-packages/askbot-0.7.43-py2.6.egg/askbot/skins/ --> Work fine

3) Location /admin/media/ = /usr/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/contrib/admin/media/ --> Not work

4) Location /upfiles/ = /home/mysite/forum/askbot/upfiles/

Please see link image for details:

http://i50.tinypic.com/35m30pd.png

Anyone help me please?

fikri's avatar
11
fikri
asked 2012-06-15 01:33:33 -0500, updated 2012-06-15 01:42:01 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

After you run command python manage.py collectstatic (it's in the manual), you'll get a directory called static, which will contain static media for all apps included into your project (as defined in the INSTALLED_APPS setting. Admin is just one of those apps.

Do re-run the collectstatic command each time you upgrade the software - that way you will rebuild contents of the static directory to match the latest version of the software.

In the webserver configuration you just need to make sure that urls to all static resources are mapped to the path to those files on the file system.

If you are using the current (at the time of this answer) settings.py template, you'll just need to map /m/ to the static directory.

For example:

    location ^~ /m/ {
            alias /srv/mysite1/static/;
    }

That should work, assuming that your settings.py file is in /srv/mysite1/, and that you're using the default settings.py template (the media-path values inside matter).

Evgeny's avatar
13.2k
Evgeny
answered 2012-06-15 01:45:25 -0500, updated 2012-06-15 01:51:58 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments