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

  1. start vagrant machine pycharm navigating tools->vagrant->up
  2. ssh vagrant box: tools->start ssh session. select vagrant @ [vagrantfolder] list appears.
  3. from terminal appears, run which python. give absolute path python on virtual machine.
  4. file->settings->project->project interpreter. click + button create new one.
  5. choose vagrant. vagrant instance folder should location of vagrantfile on host machine. python interpreter path should set absolute path found in step 3 above.
  6. click ok save. note: vagrant has up in order work.

configure project use correct interpreter

  1. from run menu, select edit configurations
  2. click + , add new django server
  3. set host 0.0.0.0. bind runserver command external ip.
  4. check run browser , set url host/port mapped vm in vagrantfile (for example, if map host's port 8080 vagrant's 8000, i'd use http://127.0.0.1:8080/)
  5. choose python interpreter set in above section python interpreter dropdown
  6. add absolute path mappings (this optional, depending on vagrantfile stored).
  7. click ok save.

run project, , enjoy glory vagrant.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -