How can I profile a Django application while running on gunicorn using python cProfile.
I can profile in development mode:
python -m cProfile -o sample.profile manage.py runserver
But what should I do when it is running in production server using gunicorn?
You can run it this way using gunicorn.
$ DJANGO_SETTINGS_MODULE=myapp.settings python -m cProfile -o output_file ../env/bin/gunicorn --workers=8 --bind 127.0.0.1:8000 myapp.wsgi:application
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With