2

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.

amirey
  • 33
  • 5
  • Did you deploy according to the official documentation? http://django-gears.readthedocs.org/en/latest/deploying.html#deploying – petkostas Aug 09 '14 at 13:58
  • I've missed the deployment step altogether, thinking that deployment means to production and not merely using an WSGI engine. I'll give that a go and report. – amirey Aug 09 '14 at 23:00

0 Answers0