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 8996485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:45:39+00:00 2026-06-15T23:45:39+00:00

We let users upload their own custom css/less to our django app. All our

  • 0

We let users upload their own custom css/less to our django app.

All our css/less files are compressed by django_compressor “on-the-fly”.

When the app is initially deployed all css files are moved to the collect-static directory.

When users upload custom css styles they replace one of the less files in the collect-static directory.

The problem with that is that the changes only appear when the apache is being reloaded thus a new css file gets generated by django-compressor.

Is there a way to force django-compressor to regenerate it’s compiled and cached files? I would not feel comfortable triggering a sudo services apache2 reload at django application level.

  • 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-06-15T23:45:40+00:00Added an answer on June 15, 2026 at 11:45 pm

    I used a different approach. I am now using offline compression, which is faster and better for multi server deployments anyways.

    I give the user an interface to change certain css and less values. I save those css/less values in a database table, so that the user can edit the stuff easily.

    To make the new css/less values available to the frontend (compiled css files) I write the values the user entered in a less file to the disk and re-run the python manage.py compress command.

    This way the compiled compressor files are generated and if the user entered invalid less code, which would lead to compile errors, the compressor stops and keeps the old css files.

    Here’s my save() method:

     def save(self, *args, **kwargs):
    
            #write the less file to the file system
            #everytime the model is saved
            try:
    
                file_location = os.path.join(settings.STATIC_ROOT, 'styles', 'less', 'custom_styles.less')
    
                with open(file_location, 'w') as f:
                    f.write(render_to_string('custom_styles/custom_stylesheet_tmpl.txt', {'platform_customizations': self}))
    
            except IOError:
                #TODO show error message to user in admin backend and via messaging system
                raise IOError
    
            #re-run offline compress command in prod mode
            management.call_command('compress')
    
    
            super(PlatformCustomizations, self).save(*args, **kwargs)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it safe to let users make their own Django templates with a set
My app users upload their files to one bucket. How can I ensure that
I'm building a web app where I need to let users upload files. I
I am thinking to let the users upload a css file and control the
I built a LAMP web application that let's users create their own profile page
I want to let users upload images from their drives. Searching around the net,
Suppose there's a java webapp that let users upload image files, it simply stores
Let's say, there is a website for an online diary. Users upload their secrets
I am writing a webpage that allows users to upload their files to Window
I want to host a game called Minecraft and let people upload their own

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.