The real racists hadn't joined the party yet back then.
When the Democratic party adopted the "liberal" (ie not racist) platform, all the Southern racists jumped over to the Republican party and hid inside the conservative Christian movement. It turned out to be a natural fit, each one providing a kind of defense against attacks aimed at the other. If people attacked the racists, they spout scripture. If people attack the weakness of their religion, they spout hate and intimidation.