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.
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.
Please sign in to leave a comment.
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.