pycharm manage.py tasks ImportError: No module nam

2019-08-09 11:43发布

问题:

When trying to execute "run manage.py Task..." in pycharm with a remote environment I'm getting the following error:

ssh://vagrant@127.0.0.1:2222/home/vagrant/.virtualenvs/telmo/bin/python3.4 -u /home/vagrant/.pycharm_helpers/pycharm/django_manage.py migrate /home/alberick/Documents/tixif-projects/telmo-api/api
bash: line 0: cd: /home/alberick/Documents/tixif-projects/telmo-api/api: No such file or directory
Traceback (most recent call last):
  File "/home/vagrant/.pycharm_helpers/pycharm/django_manage.py", line 23, in <module>
    run_module(manage_file, None, '__main__', True)
  File "/usr/lib/python3.4/runpy.py", line 178, in run_module
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/usr/lib/python3.4/runpy.py", line 112, in _get_module_details
    raise ImportError("No module named %s" % mod_name)
ImportError: No module named manage

Process finished with exit code 1 

I was having the same issue for "Run Django Console..." but I got it working using "No module named manage" in PyCharm.

回答1:

I fixed this issue by first adding a new deployment server to pycharm.

Just go into Tools / Deployment.

Click the Plus sign and configure a new SFTP connection. Then click Mappings and configure your local path and deployment server path.

Then add the remote interpreter to pycharm using "deployment configuration"

After this "run django console" and "run manage.py Task" started to work on remote for me.