docker-compose run web django-admin.py startproject puremail .
docker-compose up
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'HOST': 'db',
'PORT': 5432,
}
}
- Plug the appConfig in the INSTALLED_APPS
- Change your models (in
models.py
). - Run
python manage.py makemigrations
to create migrations for those changes - Run
python manage.py migrate
to apply those changes to the database.
docker-compose down
docker-compose run web python manage.py makemigrations
docker-compose run web python manage.py migrate
docker-compose up
docker-compose run web python manage.py sqlmigrate polls 0001
docker-compose run web python manage.py dumpdata --format=json --indent=4 -o students/fixtures/001.json
docker-compose run web python manage.py loaddata students/fixtures/001.json
docker-compose stop
docker-compose run web python manage.py createsuperuser
docker-compose start
run this on local machine
python3 -m smtpd -n -c DebuggingServer localhost:1025
from django.core.mail import send_mail
send_mail('Subject here', 'Here is the message.', '[email protected]', ['[email protected]'], fail_silently=False)
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = 'xxxxxxxx'
EMAIL_HOST_PASSWORD = 'xxxxxxxx'
EMAIL_MAIN = '[email protected]'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
or
EMAIL_BACKEND = "sendgrid_backend.SendgridBackend"
SENDGRID_API_KEY = "xxx"
#os.environ["SENDGRID_API_KEY"]