Last Updated: March 14, 2019
· lemuelf

Disable warnings when running django's manage.py

Python spewing warnings when trying to tab-complete django management commands like this?

$ ./manage.py bower/Users/lemuelf/.virtualenvs/hotel-deals/src/sorl-thumbnail/sorl/thumbnail/helpers.py:5: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9.
  from django.utils.importlib import import_module

bower          bower_freeze   bower_install

Then edit your manage.py file and add -W ignore to the shebang line.

#!/usr/bin/env python -W ignore
import os
import sys

Much cleaner now

$ ./manage.py bower
bower          bower_freeze   bower_install