You can go back to the gym. Just take a few precautions.
1. Start with only the upper body work-outs for first two to three weeks.
2. First try walks for half an hour or swimming before starting lower limb exercises.
3. Exercises like straight leg raising should be done with extreme caution as this puts a lot of strain on the lumbar region.
4. Stop immediately if any exercises give you extra pain.
5. Exercises in long sitting position should also be done with caution.