1

In a local testing environment, python manage.py runserver is like this wonderful all-seeing-eye for activity in your development and page requests.

But in the actual server environment it's a black box - you can't see much of anything or diagnose issues.

How do you get an interface such as in manage.py runserver in a live environment?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
1Up
  • 994
  • 2
  • 12
  • 24

1 Answers1

1

Server Logs

Mostly, server logs typically replace the stream of information in the console. You can set up logging here: https://docs.djangoproject.com/en/1.8/topics/logging/

Django exception email

With DEBUG off, and settings.ADMINS set, you will automatically receive a full traceback debug email every time there's an exception.

Runserver

You can also still run runserver on production environments, then hit the URL via CURL or other to say drop into pdb if it's an app issue.

Error monitoring tools

There are other tools, such as sentry https://github.com/getsentry/sentry which is a joy to use and debug issues. It takes exceptions and sends them to a multi platform (even frontend/JS exceptions) exception monitoring tool and draws lots of useful exception data.

Newrelic is another application monitoring tool that would automatically track exceptions with full tracebacks.

Brute force

You can always write to files with only a few lines of python without relying on any major tools:

with open('some-file.txt', 'a') as f:
    f.write('foobar\n')
Yuji 'Tomita' Tomita
  • 115,817
  • 29
  • 282
  • 245