To use in dev environments
- after
python manage.py shell
from django.contrib.auth.models import User| #!/usr/bin/env python3 | |
| # Author: Sean Pesce | |
| # References: | |
| # https://stackoverflow.com/questions/19705785/python-3-simple-https-server | |
| # https://docs.python.org/3/library/ssl.html | |
| # https://docs.python.org/3/library/http.server.html | |
| # Shell command to create a self-signed TLS certificate and private key: | |
| # openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out cert.crt -keyout private.key |
| import os, contextlib | |
| @contextlib.contextmanager | |
| def temp_chdir(path): | |
| """ | |
| Usage: | |
| >>> with temp_chdir(gitrepo_path): | |
| ... subprocess.call('git status') | |
| """ | |
| starting_directory = os.getcwd() |