Debugging Django - CReSIS/OLD_OPS GitHub Wiki
This page contains information relevant to debugging Django views.
Information to be aware of:
-
The createPath view is logged by python to /cresis/snfs1/web/ops2/django_logs/createPath.log. This log can be used to monitor progress and track down potential inefficiencies during large path insertions. Currently, the createPath.log is cleared on the 1st of every month.
-
The debugView.py script located in the /var/django/ops/ops/ directory can be used to debug views on the server line-by-line using an IDE such as eclipse or VSCode. See the Using Eclipse - Debugging in Eclipse or Using VSCode to Debug Django page for more information.
-
The Pydev plugin for eclipse provides a method of remote debugging code running on the server. Please see Using Eclipse - Remote Debugging for more information.
-
If one sets gOps.profileCmd = True in opsCmd.m, the python line_profiler will keep track of the time it takes to run each line of code in a view. This can be useful for tracking down particularly inefficient/slow portions of code. The reports generated by line_profiler are kept in /var/profile-logs/txt/ and can be viewed over the web at serverUrl/profile-logs/
-
One can set DEBUG = True in /var/django/ops/ops/settings.py to get more detailed error messages from django. This can be useful when a syntax error is present in a view because django will generate an html page showing the first offending line if one opens a view's url in a web browser.
-
OPS tests can be used to check views against expected output and provides an automated way of quickly testing alterations to the OPS Django application.