Use hasattr instead of try/except to call django setup.