python - Using PyCharm Professional and Vagrant, how do I run a Django server? -
i have set configuration run server remotely. when click run, see command used:
ssh://vagrant@localhost:2222/usr/bin/python -u "c:/users/myname/projectname/config/manage.py" runserver localhost:8080
(i've replaced directory names anonymity reasons).
when run this, fails (obviously) because it's using windows path manage.py error is
`/usr/bin/python: can't open file 'c:/users/myname/judgeapps/config/manage.py': [errno 2] no such file or directory
what can't figure out after extensive googling, how force django use path on vagrant machine. how can go doing this?
the trick creating python interpreter in pycharm, , configuring project use interpreter.
note: following applies pycharm professional 4.0.
create python interpreter vagrant
- start vagrant machine pycharm navigating
tools->vagrant->up
- ssh vagrant box:
tools->start ssh session
. selectvagrant @ [vagrantfolder]
list appears. - from terminal appears, run
which python
. give absolute path python on virtual machine. file->settings->project->project interpreter
. click + button create new one.- choose
vagrant
.vagrant instance folder
should location of vagrantfile on host machine.python interpreter path
should set absolute path found in step 3 above. - click ok save. note: vagrant has
up
in order work.
configure project use correct interpreter
- from
run
menu, selectedit configurations
- click + , add new
django server
- set
host
0.0.0.0
. bindrunserver
command external ip. - check
run browser
, set url host/port mapped vm in vagrantfile (for example, if map host's port8080
vagrant's8000
, i'd usehttp://127.0.0.1:8080/
) - choose
python interpreter
set in above sectionpython interpreter
dropdown - add absolute
path mappings
(this optional, depending on vagrantfile stored). - click ok save.
run project, , enjoy glory vagrant.
Comments
Post a Comment