Django's runserver
command doesn't output a stack trace when I append --traceback --verbosity 2
:
➫ python manage.py runserver --traceback --verbosity 2
Validating models...
0 errors found
July 24, 2013 - 11:45:12
Django version 1.5.1, using settings 'base.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[24/Jul/2013 11:45:27] "POST /login/get_associations/ HTTP/1.0" 500 13220
Are there other command line switches or logging configuration I can add to get runserver
to print a stack trace when there is a 500
?
The site could be temporarily unavailable or too busy. Try again in a few moments. If you are unable to load any pages, check your computer's network connection. If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
Just type on other machine in browser http://192.168.0.1:8000 where 192.168. 0.1 is IP of you server... and it ready to go.... or in you case: On machine A in command line ./manage.py runserver 0.0.
It is your tool for executing many Django-specific tasks -- starting a new app within a project, running the development server, running your tests... It is also an extension point where you can access custom commands you write yourself that are specific to your apps.
Agreed that this is convenient, especially for MVVM-centric app development (e.g. Angular/Ember front-end). Also this is helpful when others are testing out the front-end.
As you mentioned, this isn't provided by DEBUG=True
. You can add a stacktrace when running ./manage.py runserver
by adding the following to the settings.py file:
LOGGING = {
'version': 1,
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
},
},
'loggers': {
'django.request': {
'handlers': ['console'],
'propagate': True,
'level': 'DEBUG',
},
},
}
This syntax comes from the Django documentation Configuring Logging and can be further modified to increase or decrease the amount of console-logging.
Also note that 5XX responses are raised as ERROR messages and 4XX responses are raised as WARNING messages.
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