Except for African Americans, who are both very religious and very Democratic.
Putnam and Campbell consider several issues that might connect religiosity and partisanship. This is their overall conclusion on this issue:
The glue which holds religiosity and partisanship together is the political salience of two issues in particular: abortion and same-sex marriage.
In the late '70s the two parties took the same position on these issues, so religious traditionalists had nowhere in particular to go. From the first Reagan election on, though, the Republican Party took a conservative line on both of these issues. There after, the Republican Party and the Democratic Party clearly captured the conservative religious and liberal secular poles of the electorate, respectively.