Using PyCharm Professional and Vagrant, how do I start a Django server?

I have already configured my configuration so that it remotely starts the server. When I click run, I see the command used:

ssh://vagrant@localhost:2222/usr/bin/python -u "C:/Users/MyName/ProjectName/config/manage.py" runserver localhost:8080

(I replaced the directory names for anonymity).

When I run this, it fails (obviously) because it uses the path to my manage.py file In particular, I get an error

`/usr/bin/python: can't open file 'C:/Users/MyName/judgeapps/config/manage.py': [Errno 2] No such file or directory

What I can’t understand after an extensive Google search is how to get the django to use the path on my vagrant machine. How can i do this?

+4
source share
1 answer

Python PyCharm .

. PyCharm Professional 4.0 .

Python

  • PyCharm, Tools->Vagrant->Up
  • SSH "": Tools->Start SSH Session. Vagrant at [VagrantFolder] .
  • which python. python .
  • File->Settings->Project->Project Interpreter. +, .
  • Vagrant. Vagrant instance folder VagrantFile . Python interpreter path , 3 .
  • , . : up, .

  • Run Edit Configurations
  • + Django Server
  • Host 0.0.0.0. runserver IP-.
  • Run browser URL- /, VagrantFile (, 8080 Vagrant 8000, http://127.0.0.1:8080/)
  • Python interpreter, , Python interpreter
  • path mappings ( , , VagrantFile).
  • , .

, .

+10

All Articles