Debug remotely with PyCharm a Flask application running on Apache Follow
I'm on the following scenario:
- Programming a Flask application locally in PyCharm.
- Remote Deploy on a server using Apache (wsgi_mod)
- Access to the server via SSH
On the server I get a segmentation fault that locally doesn't happen to me (Dockerization in progress...) and I would need to debug from my computer what happens on the server.
I found this PyCharm link but I'm not able to make it work. I don't know if it's because in these conditions you can't or I'm doing it wrong.
Locally my application runs in localhost:<LOCAL_PORT>
and in the server the configuration is:
<VirtualHost *:80>
ServerName <URL>
WSGIDaemonProcess <PROCESS_NAME> user=<USER> group=<GROUP> threads=<N> python-path=<PYTHON_PATH>
WSGIScriptAlias / <REMOTE_PROJECT_FOLDER>/<SCRIPT>.wsgi
<Directory <REMOTE_PROJECT_FOLDER>>
WSGIProcessGroup <PROCESS_NAME>
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Is there any way that, without major server-side modifications, I can debug that application? I don't understand if the following should be added locally, remotely or in both places:
import pydevd_pycharm
pydevd_pycharm.settrace('172.20.208.95', port=12345, stdoutToServer=True,
stderrToServer=True)
And I'm not sure which IP / port (local? Remote?) to use for debug either.
I know that Docker is the solution for these cases but it is not currently implemented.
Please sign in to leave a comment.