Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在Pycharm的虚拟环境中运行grunt,以便调试代码?_Python_Gruntjs_Pycharm_Virtualenv - Fatal编程技术网

Python 如何在Pycharm的虚拟环境中运行grunt,以便调试代码?

Python 如何在Pycharm的虚拟环境中运行grunt,以便调试代码?,python,gruntjs,pycharm,virtualenv,Python,Gruntjs,Pycharm,Virtualenv,我目前正在虚拟环境中从cmd行运行grunt,方法是执行以下命令分别启动虚拟环境和grunt服务器 source ./env/bin/activate grunt serve 如何从Pycharm运行此服务器,以便逐步浏览项目代码 这是我当前尝试运行时收到的错误消息。如果我尝试从命令行运行grunt Service,但我不在虚拟环境中(即,在尝试启动grunt Service之前,PyCharm似乎没有激活virtualenv),则得到的消息与此完全相同: /usr/local/bin/nod

我目前正在虚拟环境中从cmd行运行grunt,方法是执行以下命令分别启动虚拟环境和grunt服务器

source ./env/bin/activate
grunt serve
如何从Pycharm运行此服务器,以便逐步浏览项目代码

这是我当前尝试运行时收到的错误消息。如果我尝试从命令行运行grunt Service,但我不在虚拟环境中(即,在尝试启动grunt Service之前,PyCharm似乎没有激活virtualenv),则得到的消息与此完全相同:

/usr/local/bin/node--debug brk=51383--expose_debug_as=v8debug/usr/local/lib/node_modules/grunt cli/bin/gruntfile--gruntfile/Users/tcl/_myproject/workspace/myproject_web/gruntfile.js
正在[:]上侦听的调试器:51383
正在运行“bgShell:runDjango”(bgShell)任务
运行“监视”任务
正在等待…>>回溯(最近一次呼叫最后一次):
>>文件“myproject\u web/manage.py”,第13行,在
>>从configurations.management导入从命令行执行
>>ImportError:没有名为configurations.management的模块
>>错误:命令失败:python myproject_web/manage.py runserver 0.0.0.0:7000
我猜是在这里完成的:

按下Environment(环境)按钮会显示这一点(我不确定在这里输入什么,或者这是否是正确的配置位置)

我还尝试使用以下命令从虚拟环境命令行启动Python:

  • 开放式应用程序
  • 在菜单栏中查找工具
  • 创建命令行启动器
  • 编辑:

    我还尝试使用PyCharm创建一个新的virtaulenv PyCharm->首选项->[my_project]->项目解释器->[gear_图标]->创建虚拟环境

    然后,我将项目环境设置为该环境,并尝试启动grunt服务器,但出现了相同的错误:

    /usr/local/bin/node --debug-brk=51694 --expose_debug_as=v8debug /usr/local/lib/node_modules/grunt-cli/bin/grunt --gruntfile /Users/tcl/_my_project/workspace/my_project_web/Gruntfile.js serve
    Debugger listening on [::]:51694
    Running "bgShell:runDjango" (bgShell) task
    
    Running "watch" task
    Waiting...>> Traceback (most recent call last):
    >>   File "my_project_web/manage.py", line 13, in <module>
    >>     from configurations.management import execute_from_command_line
    >> ImportError: No module named configurations.management
    >> Error: Command failed: python my_project_web/manage.py runserver 0.0.0.0:7000
    
    /usr/local/bin/node--debug brk=51694--expose_debug_as=v8debug/usr/local/lib/node_modules/grunt cli/bin/grunt--gruntfile/Users/tcl/_my_project/workspace/my_project\u web/gruntfile.js
    正在[:]上侦听的调试器:51694
    正在运行“bgShell:runDjango”(bgShell)任务
    运行“监视”任务
    正在等待…>>回溯(最近一次呼叫最后一次):
    >>文件“my_project_web/manage.py”,第13行,在
    >>从configurations.management导入从命令行执行
    >>ImportError:没有名为configurations.management的模块
    >>错误:命令失败:python my_project_web/manage.py runserver 0.0.0.0:7000
    
    虚拟环境似乎没有被激活。如何激活virtualenv以使grunt工作(我曾尝试从终端窗口激活它,但PyCharm不在激活版本中)

    /usr/local/bin/node --debug-brk=51694 --expose_debug_as=v8debug /usr/local/lib/node_modules/grunt-cli/bin/grunt --gruntfile /Users/tcl/_my_project/workspace/my_project_web/Gruntfile.js serve
    Debugger listening on [::]:51694
    Running "bgShell:runDjango" (bgShell) task
    
    Running "watch" task
    Waiting...>> Traceback (most recent call last):
    >>   File "my_project_web/manage.py", line 13, in <module>
    >>     from configurations.management import execute_from_command_line
    >> ImportError: No module named configurations.management
    >> Error: Command failed: python my_project_web/manage.py runserver 0.0.0.0:7000