Debugger - ERPNext Frappe
Debugger - ERPNext Frappe
- SMTP Server Setup:
why?
To send emails to bypass the password reset functionality.
kali@kali:~$ ssh frappe@192.168.121.123
frappe@ubuntu:~$ sudo nano /home/frappe/frappe-bench/sites/site1.local/site_config.json
{
"db_name": "_1bd3e0294da19198",
"db_password": "32ldabYvxQanK4jj",
"db_type": "mariadb",
"mail_server": "192.168.45.219",
"use_ssl": 0,
"mail_port": 25,
"auto_email_id": "admin@randomdomain.com"
}
kali@kali:~$
sudo python3 -m aiosmtpd -n -l 0.0.0.0:25
# Note: requires `pip install aiosmtpd` (smtpd was removed in Python 3.12)
- Remote Debugging Setup:
Download vscode. Install debugpy, and comment out web server, to start the server later.kali@kali:~$ sudo apt install ~/Downloads/code_1.45.1-1589445302_amd64.deb frappe@ubuntu:~$ /home/frappe/frappe-bench/env/bin/pip install debugpy frappe@ubuntu:~$ sudo vim /home/frappe/frappe-bench/Procfile# Comment out the web server line #web: bench serve --port 8000
==Python debugpy to set up debugger. ==
# /home/frappe/frappe-bench/apps/frappe/frappe/app.py
import debugpy; debugpy.listen(('0.0.0.0', 5678)); debugpy.wait_for_client()
kali@kali:~$ rsync -azP frappe@192.168.121.123:/home/frappe/frappe-bench ./
- MariaDB Query Logging:
frappe@ubuntu:~$ sudo vim /etc/mysql/my.cnf
[mysqld]
general_log_file = /var/log/mysql/mysql.log
general_log = 1
frappe@ubuntu:~$ sudo systemctl restart mysql
frappe@ubuntu:~$ sudo tail -f /var/log/mysql/mysql.log
5.2 Start the frappe server
cd /home/frappe/frappe-bench/
bench start
cd /home/frappe/frappe-bench/sites
../env/bin/python ../apps/frappe/frappe/utils/bench_helper.py frappe serve --port 8000 --noreload --nothreading