Skip to content

Instantly share code, notes, and snippets.

@kingbuzzman
Last active September 21, 2018 15:54
Show Gist options
  • Save kingbuzzman/3784b49bffa4f14b2b08575541ed7a1e to your computer and use it in GitHub Desktop.
Save kingbuzzman/3784b49bffa4f14b2b08575541ed7a1e to your computer and use it in GitHub Desktop.
Fork django / commit to it using docker
# Steps to running django quickly to make a PR.
# 1. Fork django on github: https://github.com/django/django
# 2. Make sure that you've setup your ssh keys for github: https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/
# IMPORTANT: *** Please ignore if you've already done it ***
# 3. Copy and paste this directly into your terminal:
docker run -v $(pwd)/django:/django -v ~/.ssh:/root/.ssh -v ~/.gitconfig:/root/.gitconfig -it --rm python:3.7 bash -c '
# update the machine
apt-get update && \
# install dependencies
apt-get install -y libmemcached-dev zlib1g-dev libssl-dev build-essential vim && \
# clone the repo if it doesnt exist
(if [ ! -d /django/django ]; then
# dont be afaid of this, this just gets your github username and adds it into the clone url
# this is here so there is no placeholder "git@github.com:<insert your username here>/django.git"
# and anyone can just copy and paste it. also django is 250MB+ so we only get the last 50 commits to try and keep the size down.
git clone --depth 50 git@github.com:`ssh -T git@github.com 2>&1 | cut -d " " -f 2 | rev | cut -c 2- | rev`/django.git
fi) && \
# go into the django code
cd django && \
# add the remote "upstream" if it doesnt exist
(if ! git config remote.upstream.url > /dev/null; then
git remote add upstream https://github.com/django/django
fi) && \
# install django
pip install -e . && \
# install django test dependencies
pip install -rtests/requirements/py3.txt && \
# make a new line and add instructions for the user to follow
echo && \
echo "Run: ./tests/runtests.py" && \
# give the user the prompt so they chose what they really want to do
exec bash
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment