不能减少Django在Windows上的工作

2024-04-25 14:27:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用这个库在我的django项目上运行lesscss: https://github.com/andreyfedoseev/django-less/

它在Mac和Linux上运行良好,但我在Windows上遇到了一个错误,无法找到解决方案。在

这是django错误:

Request Method: GET
Request URL:    localhost:8000
Django Version: 1.4.5
Exception Type: WindowsError
Exception Value:    2 The system cannot find the specified file
Exception Location: C:\Python27\lib\subprocess.py in _execute_child, line 896
Python Executable:  C:\Python27\python.exe
Python Version: 2.7.3
Python Path:    
['C:\\soundgathr\\GemsBand',
 'C:\\Windows\\system32\\python27.zip',
 'C:\\Python27\\DLLs',
 'C:\\Python27\\lib',
 'C:\\Python27\\lib\\plat-win',
 'C:\\Python27\\lib\\lib-tk',
 'C:\\Python27',
 'C:\\Python27\\lib\\site-packages']
Server time:    Fri, 22 Mar 2013 23:42:11 +0100
Error during template rendering

In template C:\soundgathr\GemsBand\static\templates\blocks\head.html, error at line 7

以下是我在模板中对less的调用:

^{pr2}$

还有我的设置.py公司名称:

# Less path settings
LESS_OUTPUT_URL = os.path.join(MEDIA_URL, 'LESS_CACHE')
LESS_OUTPUT_DIR = os.path.join(MEDIA_ROOT, 'LESS_CACHE')

同样,它在Mac&Linux上运行良好。在

我认为这是一个路径和斜杠,反斜杠的问题。有什么想法吗?在


Tags: pathdjangopyurlversionrequestlinuxwindows
1条回答
网友
1楼 · 发布于 2024-04-25 14:27:15

django less for Windows有一个问题。它使用子进程来调用lessc命令,但是,as you can see here,您需要传递shell=True使其在Windows上工作。在

尝试在django中少修改以下行/实用工具.py在

p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

通过

^{pr2}$

相关问题 更多 >