Django-gears Assets Path Issue

100 Views Asked by At

I've been using Django with django-gears in my development environment, and was having good fun with it. I'm now preparing for deployment and set to use uWSGI (rather than manage.py runserver). Doing so broke something, and the resolution of assets path is now broken. The GEARS_DIRS config variable seems to not take effect. I am a relatively new user of Gears, and spent now a good few hours trying to debug this problem.

My settings are: BASE_DIR = os.path.dirname(os.path.dirname(file))

GEARS_DIRS = (
    os.path.join(BASE_DIR, "assets"),
    os.path.join(BASE_DIR, "static"),
)

I'm getting an error:

u'./assets' is not an absolute path.

when rendering, in a template, the following:

{% load gears %}
{% load url from future %}
{% load i18n %}
{% css_asset_tag "stylesheets/application.css" %}
{% js_asset_tag "javascripts/application.js" %}

with the css_asset_tag line highlighted. I tried another option:

SITE_ROOT = os.path.realpath(os.path.dirname(__file__))

GEARS_DIRS = (
    os.path.join(SITE_ROOT, "assets"),
    os.path.join(SITE_ROOT, "static"),
)

And that resulted in

u'./<app_name>/assets' is not an absolute path.

Through debugging, I can see that the paths in SITE_ROOT and BASE_DIR are as intended and point to the the directory where the assets and static directories reside.

Any help would be appreciated.

0

There are 0 best solutions below