PyCharm + Vagrant + Django -- PyCharm looking for manage.py on LOCAL path as opposed to remote path

This has been an intermittent problem every since I've been using PyCharm that persists in 4.0, and it happens on Windows, Mac, and Linux.

When configuring PyCharm with Vagrant and setting up a Django runtime configuration, PyCharm will occasionally (persistently in my current case, hence finally posting here to see what might be going on) look for manage.py on the local machine as opposed to the remote environment.

Specifically after configuring the runtime configuration and hitting the "play" button, the following is output in the console:
ssh://vagrant@127.0.0.1:2222/usr/bin/python3 -u C:/Users/foo/bar/baz/manage.py runserver 0.0.0.0:8000
bash: line 0: cd: C:/Users/foo/bar/baz: No such file or directory
/usr/bin/python3: can't open file 'C:/Users/foo/bar/baz/manage.py': [Errno 2] No such file or directory

Process finished with exit code 2

So as you can see PyCharm is trying to find C:/... on the vagrant box and I don't see a way to specify the path on the vagrant box in a way that PyCharm will understand it.

When it DOES work I do exactly the same thing as when it doesn't, namely in the runtime configuration I browse to my local directory as the working directory and PyCharm figures it out some of the time. Other times it behaves like this.

As I said this happened on PyCharm 3.x, persiste on PyCharm 4, and I've personally seen it occur on Mac, Windows, and Linux so it's not a problem that's unique to Windows (even though that's what I happen to be using in the example here).

Thanks for any thoughts anyone might be able to provide on this highly annoying issue.
5 comments
Comment actions Permalink
I experienced same errors. I also don't know exactly but I solved this problem making vagrant by pycharm menu instead of command line(ex. git bash)
0
Comment actions Permalink
Thanks, but that didn't resolve it. 4.01 upgrade didn't help either. It seems to consistently NOT work on the machine I'm messing with now.
0
Comment actions Permalink
I've been trying out PyCharm for the Django Tutorial project lately and I ran into a problem with the Django Console (and manage.py tasks). I'm running Windows 7 with PyCharm 2.7.2 and use a Ubuntu 12.04 Virtualbox (with virtualenv) for the project.
0
Comment actions Permalink
Have you tried using the path mappings configuration in the Run/Debug settings?  I didn't need to set it explicitly in Pycharm 3.0.  I think that it's set automatically, if you define your remote project interpreter using vagrant settings, but not if you define the remote project interpreter using manual ssh settings.  

I ran into this because Pycharm 4.0 has a bug that keeps mac users from using the Vagrant Remote Interpreter configuration.  Anyway, when I map my local project directory to /vagrant, it starts working again.
0
Comment actions Permalink
That did it – thanks so much! Was driving me and my coworkers nuts for quite some time. Really appreciate the tip.
0

Please sign in to leave a comment.