Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7129131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:12:39+00:00 2026-05-28T11:12:39+00:00

Here’s the scenario: I’m running Django 1.3.1, utilizing staticfiles, and django-compressor (latest stable) to,

  • 0

Here’s the scenario:

I’m running Django 1.3.1, utilizing staticfiles, and django-compressor (latest stable) to, among other things, compile LESS files.

I have an “assets” directory that’s hooked into staticfiles with STATICFILES_DIRS (for project-wide static resources). In that directory I have a “css” directory and in that a “lib.less” file that contains LESS variables and mixins.

So the physical path is <project_root>/assets/css/lib.less and it’s served at /static/css/lib.less.

In one of my apps’ static directory, I have another LESS file that needs to import the one above. The physical path for that is <project_root>/myapp/static/myapp/css/file.less and it would be served at /static/myapp/css/file.less.

My first thought was:

@import "../../css/lib.less"

(i.e. based on the URL, go up to levels from /static/myapp/css to /static/, then traverse down into /static/css/lib.less).

However, that doesn’t work, and I’ve tried just about every combination of URLs and physical paths I can think of and all of them give me FilterErrors in the template, resulting from not being able to find the file to import.

Anyone have any ideas what the actual import path should be?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:12:39+00:00Added an answer on May 28, 2026 at 11:12 am

    After tracking down exactly where the error was coming from in the django-compressor source. It turns out to be directly passed from the shell. Which clued me into removing all the variables and literally just trying to get the lessc compiler to parse the file.

    Turns out it wants a relative path from the source file to the file to be imported in terms of the physical filesystem path. So I had to back all the way out to my <project_root> and then reference assets/css/lib.less from there. The actual import that finally worked was:

    @import "../../../../assets/css/lib.less"
    

    What’s very odd though is that lessc would not accept an absolute filesystem path (i.e. /path/to/project/assets/css/lib.less). I’m not sure why.

    UPDATE (02/08/2012)

    Had a complete “DUH” moment when I finally pushed my code to my staging environment and ran collectstatic. The @import path I was using worked fine in development because that was the physical path to the file then, but once collectstatic has done it’s thing, everything is moved around and relative to <project_root>/static/.

    I toyed with the idea of using symbolic links to try to match up the pre and post-collectstatic @import paths, but I decided that that was far too complicated and fragile in the long run.

    SO… I broke down and moved all the LESS files together under <project_root>/assets/css/, and rationalized moving the LESS files out of the apps because since they’re tied to a project-level file in order to function, they’re inherently project-level themselves.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's an exerpt from the ADT's latest changelog: Build performance improvements. The big changes
here is my configuration: http://domain.com (obviously fictitious name...) hosted on a server running Apache
Here's my scenario - I have an SSIS job that depends on another prior
Here is the scenario: I'm writing an app that will watch for any changes
here is the scenario 1: user starts to type some word, autocomplete engine shows
Here is my XML <response> <statusCode>200</statusCode> <statusText>OK</statusText> <data> <getAssetResponse> <assetId>89898</assetId> <content> some text with
Here is my model: class Company(models.Model): id = models.AutoField(primary_key=True); name = models.CharField(max_length=100); address =
Here's the code I'm using to download a file var S3_KEY = 'xxxxxx'; var
Here's my code Form1 TicketDetails td = new TicketDetails(getTicketID()); td.Show(); I want to close
Here are my Codes ... I want to remove Elements that are listed in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.