When I try to run my Django app via PyCharm inside of Vagrant, it sends my Windows Path over SSH which then provides an error in the shell:
> ssh://[email protected]:2200/usr/bin/python -u C:/Projects/dev_project/dev/manage.py runserver 0.0.0.0:8000
bash: line 0: cd: C:/Projects/dev_project/dev: No such file or directory /usr/bin/python: can't open file 'C:/Projects/dev_project/dev/manage.py': [Errno 2] No such file or directory
I created a Python Project in PyCharm (and instantiated a Django Project in a sub-folder) in order to incorporate Vagrant.
dev_project (PyCharm project root)
|--.vagrant
|--dev (Django project root)
|--dev
|--app
|--manage.py
|--Vagrantfile
In Settings
I enabled Django Support (providing the Windows Paths as there is no other option) in Settings > Languages & Frameworks > Django. The Vagrant Python Interpreter is selected as the Project Interpreter (and Django Console & Python Console)
In Run Configurations
My host is 0.0.0.0 and port is 8000 My Python Interpreter is the Vagrant Environment. I am also adding the Content Roots & Source Roots to the Python Path.
The bizarre problem is it was working fine, and then I exited out and it broke again. Also, I do not have 'Working Directory' explicitly defined anywhere.
This blog article showed me my issue, as I did not have my Path Mappings setup within my Run Configuration.
From the Article (Configure Your Project to Use the Correct Interpreter):