Ask Your Question
1

Where Location of Admin Media on Nginx?

asked 2012-06-15 01:33:33 -0600

fikri gravatar image

updated 2012-06-15 01:42:01 -0600

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-06-15 01:45:25 -0600

Evgeny gravatar image

updated 2012-06-15 01:51:58 -0600

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).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-06-15 01:33:33 -0600

Seen: 345 times

Last updated: Jun 15 '12