Use params-provided username and password if available

Prefer os.environ or explicitly-constructed values over params
for backwards-compatibility.

This allows auth to be provided through django's CACHES setting in addition to the existing environment-variable approach.