Open kennethreitz opened 12 years ago
In Silver Lining I provided both. DBAPI connections for instance frequently want the separated values. Django does too. SQLAlchemy and SQLObject use URI strings. They don't all agree on the schemes, and sometimes they include database type and database driver in the string (even though the environment probably shouldn't care about database driver, e.g., MySQLdb vs pymysql - that's really an application preference).
In practice it's not that easy to convert between the two, which is why providing both is kind of nice.
In the database configuration section, things are a bit verbose:
This could easily be consolidated to a single
database
config.Example:
postgres://uh1x438ayyz6v:pgpptat9yofmyie7@ec2-50-17-187-253.compute-1.amazonaws.com:5432/dl2jcx3le9wlq
Format:
type://username:password@host:port/dbname
Many other communities are doing this, and many database systems (SQLAlchemy, for example), support this style of URL out of the box. Stdlib's urlparse makes it extremely simple to get the needed values out if not. It saves an amount of verbosity.