How to create multiple configurations (settings.py) for a Django project?
📁 example, django, debug, project
It's quite obvious that, for example, in production and during development, the project configuration should be different. However, by default Django provides for using a single settings.py, which contains everything without any hints of separation. And we want to separate it.
For example, during development you can enable DEBUG = True and connect the Debug Toolbar, which cannot be done in production, use some specific local developer database, relax restrictions, etc.
Also, if you want to publish a Django project on some GitHub, adding settings.py with all the passwords to the repository is not cool at all. And if you remove passwords from there, commit, and then put the passwords back, it's all completely inconvenient.
For Yandex, I managed to authenticate using AUTH PLAIN over an SSL connection. This code works:
#!/usr/bin/env python3import smtplib as smtpfrom getpass import getpassemail = input('enter email: ')password = getpass('enter password: ')dest_email = input('enter recipient address: ')subject = input('email subject: ')email_text = input('email body: ' )message = 'From: {}To: {}Subject: {}\\ Log in to leave an answer