I'm attempting to add the google cloud profiler to my Django App Engine project, and would like to know where the best place to call it is?
Google Cloud Platform's documentation says to start the profiler as early as possible:
You should call start one time, and as early as possible in your application.
In a Django project, running on GCP App Engine Flex, where is the best place to call this so that 1. It is called only once, 2. It is not called on things like tests, migrations etc.
My initial thought was to place it in manage.py under execute_from_command_line
, but I realised that this would call the profiler for simple things like manage.py test
.
Django 2.2, App Engine Flexible, Gunicorn.