We present a study of the nearest--neighbor (nn) and next-nearest-neighbor (nnn) exchange constants between magnetic Cu centers of the spin-Peierls material CuGeO3. The dependence of these constants on the lattice parameters (modified e.g. by variation of temperature, pressure or doping) is calculated. Based on the observation that the bond angles are more susceptible than the bond lengths we propose the so-called accordion model for the description of the properties of CuGeO3. We show that the nn exchange constant in the CuO2 ribbon is very sensitive to the presence and position of the side group Ge with respect to this ribbon. The angle between the two basic units the CuO2 ribbon and the GeO3 zig-zag chain is, besides the Cu-O-Cu angle in the ribbon, one of the principal lattice parameters determining the nn exchange in the c direction. The microscopic calculations of different exchange constants and their dependence on the lattice parameters are carried out using different schemes (perturbation theory; exact diagonalization of Cu2O2 clusters; band approach). The results compare favorable with experiment. The influence of Si doping is also calculated, and the reasons of why it is so efficient in suppressing the spin-Peierls phase are discussed. Thus the consistent microscopic picture of the properties of CuGeO3 emerges.