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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:16:58+00:00 2026-06-15T09:16:58+00:00

I wrote bash script converting *.less files into *.css using lessc. Unfortunately run function

  • 0

I wrote bash script converting *.less files into *.css using lessc.
Unfortunately run function from BaseRunserverCommand restarts server only, when *.py files was modified.
How can I solve this?

  • 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-15T09:16:59+00:00Added an answer on June 15, 2026 at 9:16 am

    Correct overriding code_changed() function seemed a bit hard,so I decided to write my own script converting *.less files which was modified or had no *.css file.
    This script is running in reloader_thread():

    import sys, time
    from subprocess import call
    
    from django.conf import settings
    from django.utils import autoreload
    
    from django.core.management.commands.runserver import Command
    
    def convert_less():
        status = call([settings.CONVERT_LESS, settings.LESS_DIR, settings.CSS_DIR])
        if status != 0:
            exit(1)
    
    def reloader_thread():
        autoreload.ensure_echo_on()
        while autoreload.RUN_RELOADER:
            convert_less()
            if autoreload.code_changed():
                sys.exit(3) # force reload
            time.sleep(1)
    
    autoreload.reloader_thread = reloader_thread
    

    Tadeck, thank you for clue 🙂

    I suppose that this problem could be also solved by editing BaseCommand.option_list

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

Sidebar

Related Questions

I wrote a bash script that gets output from a website using curl and
I wrote a tiny Bash script to find all the Mercurial changesets (starting from
I wrote a function in bash script. However, it's complaining about syntax. I really
I'm trying to run multiple instances of a node server using a bash script.
I wrote a super simple bash script to get me into a python shell
I'm rewriting a Bash script I wrote into Python. The crux of that script
I wrote a simple bash script because I was using a grep command with
I wrote a bash shell script to rename the file, #!/bin/bash #renaming the files
I wrote a bash script to connect to an ftp server and download files
I wrote a trivial bash script which dumps a random line from a file

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.