#!/usr/bin/env python from django.core.management.utils import get_random_secret_key if __name__ == "__main__": with open(".env", "w") as env_file: env_file.write("""DEBUG=on SECRET_KEY={} ALLOWED_HOSTS=* DATABASE_URL=postgresql://django:django@localhost:5432/db """.format(get_random_secret_key()))