Generate settings.py function