Is there a way to exclude parts of mesh from curving when using curve modifier
Yes. Select those parts in edit mode.

Press Ctrl+i to invert selection. Everything else is selected.

Create a vertex group. Assign the selected vertices to the vertex group.

Exit edit mode. 

In Object mode apply the curve deformer and select the vertex group. It will be applied only to the parts you previously selected.