Skip to content

Commit

Permalink
Cleanup random Django version support docs (#86)
Browse files Browse the repository at this point in the history
No code changes, just:

* upgrade dev dependencies
* unify django version specific code comments to be `DJANGO<version>`
* update workflows to use more modern versions


#### Verifying change

* `make build`
* `make run`
* Browse to localhost:8000/admin/
* login with `admin`/`admin`
  • Loading branch information
crccheck committed Mar 9, 2018
1 parent 430be02 commit a7b183f
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
@@ -1,4 +1,4 @@
FROM python:2.7-alpine
FROM python:3.6-alpine3.7

RUN apk add --no-cache make

Expand Down
11 changes: 4 additions & 7 deletions Makefile
Expand Up @@ -44,19 +44,18 @@ coverage: ## Run and then display coverage report

resetdb: ## Delete and then recreate the dev sqlite database
python $(MANAGE) reset_db --router=default --noinput
-python $(MANAGE) syncdb --noinput
-python $(MANAGE) migrate --noinput
python $(MANAGE) migrate --noinput
python $(MANAGE) loaddata sample_data

.PHONY: build
build: ## Build a full set of Docker images
build: build/2.0 build/1.11.1 build/1.10.7 build/1.9.13 build/1.8.18
build: build/2.0 build/1.11.11 build/1.10.8 build/1.9.13 build/1.8.18

build/%:
docker build --build-arg DJANGO_VERSION=$* \
-t $(IMAGE):$$(echo "$*" | cut -f 1-2 -d.) .

run: run/1.11
run: run/2.0

run/%:
docker run --rm -p 8000:8000 -it $(IMAGE):$*
Expand All @@ -67,14 +66,12 @@ docker/publish: ## Publish Docker images to the hub
docker push $(IMAGE):1.10
docker push $(IMAGE):1.9
docker push $(IMAGE):1.8
docker push $(IMAGE):1.7
docker push $(IMAGE):1.6

test/%:
docker run --rm -p 8000:8000 -t $(IMAGE):$* make test

bash:
docker run --rm -it $(IMAGE):1.9 /bin/bash
docker run --rm -it $(IMAGE):2.0 /bin/bash

version:
@sed -i -r /version/s/[0-9.]+/$(VERSION)/ setup.py
Expand Down
2 changes: 2 additions & 0 deletions django_object_actions/models.py
@@ -1 +1,3 @@
# DJANGO1.7 https://docs.djangoproject.com/en/2.0/releases/1.7/#app-loading-refactor
# DELETEME and use an app config
# Empty models.py so django picks the templates
6 changes: 3 additions & 3 deletions example_project/polls/models.py
Expand Up @@ -9,7 +9,7 @@ class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')

def __unicode__(self):
def __str__(self):
return self.question

def was_published_recently(self):
Expand All @@ -24,13 +24,13 @@ class Choice(models.Model):
choice_text = models.CharField(max_length=200)
votes = models.IntegerField()

def __unicode__(self):
def __str__(self):
return self.choice_text


class Comment(models.Model):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
comment = models.TextField(null=True, blank=True)

def __unicode__(self):
def __str__(self):
return self.comment or ''
6 changes: 1 addition & 5 deletions example_project/settings.py
Expand Up @@ -36,6 +36,7 @@ def project_dir(*paths):

ROOT_URLCONF = 'example_project.urls'

# DJANGO1.9 switch to only MIDDLEWARE
MIDDLEWARE_CLASSES = MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
Expand Down Expand Up @@ -75,8 +76,3 @@ def project_dir(*paths):
},
},
]

# DJANGO1.7
SILENCED_SYSTEM_CHECKS = [
'1_7.W001',
]
15 changes: 8 additions & 7 deletions requirements.txt
Expand Up @@ -4,14 +4,15 @@
#
# pip-compile --output-file requirements.txt requirements.in
#
coverage==4.4.1
dj-database-url==0.4.2
coverage==4.5.1
dj-database-url==0.5.0
django-extensions==2.0.0
factory-boy==2.8.1
faker==0.7.17
factory-boy==2.10.0
faker==0.8.11 # via factory-boy
mock==2.0.0
pbr==3.0.1 # via mock
python-dateutil==2.6.0 # via faker
six==1.10.0 # via django-extensions, faker, mock, python-dateutil
pbr==3.1.1 # via mock
python-dateutil==2.6.1 # via faker
six==1.11.0 # via django-extensions, faker, mock, python-dateutil
text-unidecode==1.2 # via faker
typing==3.6.4 # via django-extensions
uuid==1.30
1 change: 1 addition & 0 deletions setup.cfg
Expand Up @@ -2,4 +2,5 @@
universal = 1

[flake8]
# exclude = migrations django_object_actions/__init__.py
max-line-length = 90

0 comments on commit a7b183f

Please sign in to comment.