Running Django with Run can not find LESS CSS

2024/10/11 6:38:03

I have a Django project that uses buildout. When running or debugging the application it runs fine by using my buildout script. I also use django-compressor to compress and compile my LESS files. I installed LESS server side with node and you can access the lessc binary from the shell as normal. django-compressor runs Popen to run the lessc command. When it does this and exception gets thrown: /bin/sh: lessc: command not found.

If I run /bin/sh lessc it finds it. If I drop into the interactive python and run Popen(['/bin/sh', '-c', 'lessc']) it finds it. What shell or environment does the running of Django in PyCharm use and how can I set it up to read either /etc/paths or $HOME/.bashrc, etc. lessc is located at /usr/local/bin which is in /etc/paths.

I am on Mac OSX 10.7, btw

Thanks for any support, Travis

Answer

I had the same issue. To fix this I opened terminal and

$ which lessc

which gave me /usr/local/bin/lessc

next, in Pycharm i opened the Run/Debug configurations for my project.

Under the Django server drop down I selected my project.

In the configuration view to the right click the '...' after the 'Environment variables:' field.

In this Environment Variables window I added a new line with the following data: PATH (the name) /usr/local/bin (the value)

Ensure "Include parent environment variables" is checked.

Click OK Click Apply/OK

Done

Best of luck!

https://en.xdnf.cn/q/69802.html

Related Q&A

OpenCV + python -- grab frames from a video file

I cant seem to capture frames from a file using OpenCV -- Ive compiled from source on Ubuntu with all the necessary prereqs according to: http://opencv.willowgarage.com/wiki/InstallGuide%20%3A%20Debia…

python 3.1 - Creating normal distribution

I have scipy and numpy, Python v3.1I need to create a 1D array of length 3million, using random numbers between (and including) 100-60,000. It has to fit a normal distribution. Using a = numpy.random.…

Faster way to iterate all keys and values in redis db

I have a db with about 350,000 keys. Currently my code just loops through all keys and gets its value from the db.However this takes almost 2 minutes to do, which seems really slow, redis-benchmark gav…

How to store a floating point number as text without losing precision?

Like the question says. Converting to / from the (truncated) string representations can affect their precision. But storing them in other formats like pickle makes them unreadable (yes, I want this too…

Integer in python/pandas becomes BLOB (binary) in sqlite

Storing an integer in sqlite results in BLOBs (binary values) instead of INTEGER in sqlite. The problem is the INT in the "Baujahr" column. The table is created. CREATE TABLE "Objekt&quo…

Calling Scrapy Spider from Django

I have a project with a django and scrapy folder in the same workspace:my_project/django_project/django_project/settings.pyapp1/app2/manage.py...scrapy_project/scrapy_project/settings.pyscrapy.cfg...Iv…

Python Threading: Multiple While True loops

Do you guys have any recommendations on what python modules to use for the following application: I would like to create a daemon which runs 2 threads, both with while True: loops. Any examples would b…

Visual Studio Code - input function in Python

I am trying out Visual Studio Code, to learn Python.I am writing a starter piece of code to just take an input from the user, say:S = input("Whats your name? ")When I try to run this (Mac: C…

DRF: how to change the value of the model fields before saving to the database

If I need to change some field values before saving to the database as I think models method clear() is suitable. But I cant call him despite all my efforts.For example fields email I need set to lowe…

keep matplotlib / pyplot windows open after code termination

Id like python to make a plot, display it without blocking the control flow, and leave the plot open after the code exits. Is this possible?This, and related subjects exist (see below) in numerous ot…