Dust attenuation shapes the spectral energy distributions of galaxies and any modelling and fitting procedure of their spectral energy distributions must account for this process. We present results of two recent works dedicated at measuring the dust attenuation curves in star forming galaxies at redshift from 0.5 to 3, by fitting continuum (photometric) and line (spectroscopic) measurements simultaneously with CIGALE using variable attenuation laws based on flexible recipes. Both studies conclude to a large variety of effective attenuation laws with an attenuation law flattening when the obscuration increases. An extra attenuation is found for nebular lines. The comparison with radiative transfer models implies a flattening of the attenuation law up to near infrared wavelengths, which is well reproduced with a power-laws recipe inspired by the Charlot and Fall recipe. Here we propose a global modification of the Calzetti attenuation law to better reproduce the results of radiative transfer models.