1

I am currently running grunt from the cmd line in a virtual environment by executing the following to start the virtual environment and then to start the grunt server respectively.

source ./env/bin/activate
grunt serve

How do I run this server from Pycharm so I can step though my project's code?

This is the error message I'm getting if I currently try to run it. It is the exact same message I get if I try to run grunt serve from the command line and I'm not in the virtual environment (i.e. it seems like PyCharm is not activating the virtualenv before trying to start grunt serve):

/usr/local/bin/node --debug-brk=51383 --expose_debug_as=v8debug /usr/local/lib/node_modules/grunt-cli/bin/grunt --gruntfile /Users/tcl/_myproject/workspace/myproject_web/Gruntfile.js serve
Debugger listening on [::]:51383
Running "bgShell:runDjango" (bgShell) task

    Running "watch" task
    Waiting...>> Traceback (most recent call last):
    >>   File "myproject_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 myproject_web/manage.py runserver 0.0.0.0:7000

I'm guessing it's done here:

enter image description here

Pressing the Environment button gives this (I'm not sure what to enter here, or if this is the correct place to configure this)

enter image description here

I've also tried launching Python from the virtual environment command line using this:

  1. Open Application Pycharm
  2. Find tools in menu bar
  3. Create Command-line Launcher

EDIT:

I've also tried creating a new virtaulenv from PyCharm using PyCharm->preferences->[my_project]->Project Interpreter->[gear_icon]->Create Virtual Env

I then set the project environment to this environment and tried to start the grunt server but got the same error:

/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

It seems the virtual environment isn't being activated. How do I activate the virtualenv for grunt to work (I've tried activating it from a terminal window but PyCharm isn't "in" that activated version).

John
  • 3,458
  • 4
  • 33
  • 54

0 Answers0