Visual Studio Django应用程序无法使用StaticRootPath错误进行构建

时间:2017-09-14 05:18:19

标签: python django visual-studio visual-studio-2017

我正在编写我的第一个Django应用程序,但我遇到了一个问题。当我在visual studio中构建项目时,构建失败而不会出现任何错误。 我可以让它向我显示错误的唯一方法是将输出更改为诊断模式,此时它向我显示:

Target "DetectStaticRootPath" in file "C:\Program Files (x86)\Microsoft 
Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v15.0\Python 
Tools\Microsoft.PythonTools.Django.targets" from project 
"C:\Users\OEM\Documents\TSM_shared\student-marketplace-v2\ecommerce 
test\ecommerce test.pyproj" (target "DjangoCollectStaticFiles" depends on it):
Initializing task factory "RunPythonCommandFactory" from assembly "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Python\Core\Microsoft.PythonTools.BuildTasks.dll".
Using "RunPythonCommand" task from the task factory "RunPythonCommandFactory".
Task "RunPythonCommand"
    Task Parameter:Target=import test.settings as settings; print(settings.STATIC_ROOT or '')
    Task Parameter:TargetType=code
    Task Parameter:ExecuteIn=none
    Task Parameter:WorkingDirectory=.
    Task Parameter:Environment=DJANGO_SETTINGS_MODULE=test.settings
    Task Parameter:ConsoleToMSBuild=True
    Output Property: DjangoStaticRootSetting=
Done executing task "RunPythonCommand" -- FAILED.
Done building target "DetectStaticRootPath" in project "test.pyproj" -- FAILED.

这些是构建失败的唯一部分。 以下是我的settings.py:

INSTALLED_APPS = [
'app',
'django.contrib.messages',
'django.contrib.staticfiles',
]
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR,'static/')

感谢您的时间。

0 个答案:

没有答案