6👍
For future googlers … I was able to get remote debugging working, but not via this method. I just answered a similar question about this over on the pycharm forums so thought I’d update this question with the method that did work for me.
- Go to “PyCharm/Preferences/Project Interpreter”.
- You’ll see an option to choose which python interpreter at the top of the dialog. Next to that is a gear icon. If you click on the gear icon, you’ll see an option to “Add remote” … you give it ssh credentials (or path to ssh keys) and the path to where your python interpreter is installed on the remote server (i.e.,
/usr/local/bin/python
). - In addition, the “pycharm helpers path” for me was (
/home/<username>/.pycharm_helpers
— I can’t remember if this was created automatically or not).
- You’ll see an option to choose which python interpreter at the top of the dialog. Next to that is a gear icon. If you click on the gear icon, you’ll see an option to “Add remote” … you give it ssh credentials (or path to ssh keys) and the path to where your python interpreter is installed on the remote server (i.e.,
-
Go to “Run / Edit Configurations…” and add a “Django Server” (plus sign at top left of dialog).
- Choose your new remote python interpreter as the interpreter to use (it should show up in a drop-down list of choices).
- In the “env vars” section I needed to specify my main app settings file (i.e.,
DJANGO_SETTINGS_MODULE = <app>/settings.py
). For my purposes I also needed to setHTTPS=1
. - Set the working directory to wherever your django project is on the remote server (i.e.,
/home/<username>/<xyz>/<appdir>
). -
Set the path mappings from your local dir to the remote dir (i.e.,
/Users/JohnQ/<xyz>/<appdir>=/home/<username>/<xyz>/<appdir>
). -
Because I needed other 3rd party servers (like FB, etc.) to be able to hit this server using HTTPS, I used “stunnel” on my remote server – it was pretty easy to set up).
-
In addition to this, a handy thing to do is set up deployment confirmation as well so that you can just right-click to upload newer versions of your file (under “Tools / Deployment / Configurations…”).
- Create a new one and under connection just use ssh creds or path to your keys.
- In the mappings tab, the paths are the same as what you did for the path mappings for the remote server setup.
- “Web path on server” was just “
/
” for me. After you create it, you should just be able to right-click on any file/dir and choose “Upload to…”. Note that for an initial upload I just scp’d a tar.gz up to my server to save time and I only upload via the deployment configuration for the changes I do during debugging.
I have been happily using this for remote debugging for ~4 mos., so it works fine.
3👍
I had the same symptoms and “fixed” it by turning off all Python Exception Breakpoints in the View Breakpoints window.
- Does Django have an equivalent of Rails's "bundle install"?
- Django unique model fields validation in form
- 400 Bad Request While Using `django.test.client`
2👍
For me, dropping the suspend=False
parameter did it.
The docs say @param suspend: whether a breakpoint should be emulated as soon as this function is called.
.
If you let it there, it’s connecting, but not considering the breakpoint. You should then basically use another pydevd.settrace('ip.addr')
->notice no suspend
- Django Query distinct values works but i cant use the query result
- Django forms: default values for bound forms
- Django: foreign key value in a list display admin