Derivative of Exner function
Start with the original equation. Let's first write the Hydrostatic equation: 

$$\frac{\partial p}{\partial z}=-\rho g$$

So let's prove that $$-g=c_p\theta\frac{\partial \pi}{\partial z}$$

If we use the product rule, we observe $$-g=c_p(\frac{\partial \theta \pi}{\partial z}-\pi\frac{\partial \theta}{\partial z})$$

Since $\pi=\frac{T}{\theta}$, we can say that $T=\pi\theta$, which makes the above equation

$$-g=c_p(\frac{\partial T}{\partial z}-\pi\frac{\partial \theta}{\partial z})$$

It can be shown that
$$\frac{\partial \theta}{\partial z}=\frac{\theta}{T}(\frac{\partial T}{\partial z}+\frac{g}{c_p})$$

which can be rewritten as
$$\frac{\partial \theta}{\partial z}=\frac{1}{\pi}(\frac{\partial T}{\partial z}+\frac{g}{c_p})$$

Substituting this into my fourth equation
$$-g=c_p(\frac{\partial T}{\partial z}-\frac{\pi}{\pi}(\frac{\partial T}{\partial z}+\frac{g}{c_p}))$$

From here I think you can figure it out. 

Derivation for $\frac{\partial \theta}{\partial z}$
$$\theta=T(\frac{p_0}{p})^\frac{R_d}{c_p}$$
$$log(\theta)=log(T)+\frac{R_d}{c_p}(log(p_0)-log(p))$$
$$ \frac{1}{\theta}\frac{\partial \theta}{\partial z}=\frac{1}{T}\frac{\partial T}{\partial z}-\frac{R_d}{c_p P}\frac{\partial P}{\partial z}$$
Utilizing hydrostatic equation
$$ \frac{1}{\theta}\frac{\partial \theta}{\partial z}=\frac{1}{T}\frac{\partial T}{\partial z}+\frac{R_d \rho g}{c_p P}$$
$$ \frac{1}{\theta}\frac{\partial \theta}{\partial z}=\frac{1}{T}\frac{\partial T}{\partial z}+\frac{g}{c_p T}$$

$$ \frac{\partial \theta}{\partial z}=\frac{\theta}{T}(\frac{\partial T}{\partial z}+\frac{g}{c_p })$$