Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

My "quick hack" solution, in case anyone finds it useful:

  1. forbid askbot serving static files: in askbot/views/meta.py, make media() raise an exception.
  2. in the askbot application, alias the skins directory as static:

    [askbot-devel/askbot]$ ln -s skins static
    

The second step makes staticfiles automatically recognize and process the askbot static files. Now "manage.py collectstatic" works -- all static files are in a single place, easy to deploy. (Alternative way: add os.path.join(ASKBOT_ROOT, 'skins') to STATICFILES_DIRS in settings.py).

However, askbot urls have media locations hardwired under m/ (not STATIC_URL), so we still need to adjust the web server. For nginx:

3.

    location /qa/m/  { # qa/ = settings.ASKBOT_URL
        expires      7d; # or whatever
        alias /content/of/your/settings.STATIC_ROOT/; # check filesystem permissions!
    }

If anyone finds a better/cleaner way, please let me know.

My "quick hack" solution, in case anyone finds it useful:

  1. forbid askbot serving static files: in askbot/views/meta.py, make media() raise an exception.
  2. in the askbot application, alias the skins directory as static:

    [askbot-devel/askbot]$ ln -s skins static
    

The second step makes staticfiles automatically recognize and process the askbot static files. Now "manage.py collectstatic" works -- all static files are in a single place, easy to deploy. (Alternative way: add os.path.join(ASKBOT_ROOT, 'skins') to STATICFILES_DIRS in settings.py).

However, askbot urls have media locations hardwired under m/ (not STATIC_URL), so we still need to adjust the web server. For nginx:

3.

    location /qa/m/  { # qa/ = settings.ASKBOT_URL
        expires      7d; # or whatever
        alias /content/of/your/settings.STATIC_ROOT/; # check filesystem permissions!
    }

If anyone finds a better/cleaner way, please let me know.

EDIT: Actually this entire procedure (all three steps) can be replaced by this patch to askbot code: https://github.com/piskvorky/askbot-devel/commit/0118be48b0272147aa63fd8910b99acbfaa52102