Skip to content

Commit 2eed988

Browse files
authored
Merge pull request marcgibbons#623 from marcgibbons/feature/env-updates
Add DRF 3.6, Python 3.6 to test suite
2 parents a56432c + fb0ef12 commit 2eed988

File tree

10 files changed

+34
-20
lines changed

10 files changed

+34
-20
lines changed

.travis.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
language: python
2-
python: "3.5"
2+
python:
3+
- "3.6"
4+
- "3.5"
5+
- "2.7"
36
sudo: false
47
matrix:
58
fast_finish: true
69
install:
7-
- pip install tox codecov
10+
- pip install tox tox-travis codecov
811
script:
912
- tox
1013
after_success:

Procfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: cd example_app && python manage.py runserver 0.0.0.0:$PORT --noreload
1+
web: cd example_app && gunicorn tutorial.wsgi

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ urlpatterns = [
5252
## Requirements
5353
* Django 1.8+
5454
* Django REST framework 3.5.1+
55-
* Python 2.7, 3.5
55+
* Python 2.7, 3.5, 3.6
5656

5757

5858
## Testing

app.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"keywords": ["django", "swagger", "rest", "framework"],
66
"env": {
77
"HEROKU": "1",
8-
"DISABLE_COLLECTSTATIC": "1"
8+
"DISABLE_COLLECTSTATIC": "1",
9+
"SECURE_SSL_REDIRECT": "1"
910
},
1011
"scripts": {
1112
"postdeploy": "python example_app/manage.py migrate --noinput && python example_app/manage.py loaddata users"

example_app/tutorial/settings.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
# Django settings for tutorial project.
23

34
DEBUG = True
@@ -19,6 +20,8 @@
1920
}
2021
}
2122

23+
ALLOWED_HOSTS = ['*']
24+
2225
# Local time zone for this installation. Choices can be found here:
2326
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
2427
# although not all choices may be available on all operating systems.
@@ -55,7 +58,8 @@
5558
# Don't put anything in this directory yourself; store your static files
5659
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
5760
# Example: "/home/media/media.lawrence.com/static/"
58-
STATIC_ROOT = ''
61+
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
62+
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
5963

6064
# URL prefix for static files.
6165
# Example: "http://media.lawrence.com/static/"
@@ -80,6 +84,7 @@
8084
SECRET_KEY = '98s9du5ruv!j%shx0udb#uz1g@v^xl65zm1l-_5%8cs6%c*qm$'
8185

8286
MIDDLEWARE_CLASSES = (
87+
'whitenoise.middleware.WhiteNoiseMiddleware',
8388
'django.middleware.common.CommonMiddleware',
8489
'django.contrib.sessions.middleware.SessionMiddleware',
8590
'django.middleware.csrf.CsrfViewMiddleware',
@@ -131,6 +136,9 @@
131136
'snippets',
132137
)
133138

139+
SECURE_SSL_REDIRECT = bool(int(os.environ.get('SECURE_SSL_REDIRECT', 0)))
140+
USE_X_FORWARDED_HOST = SECURE_SSL_REDIRECT
141+
134142
# A sample logging configuration. The only tangible logging
135143
# performed by this configuration is to send an email to
136144
# the site admins on every HTTP 500 error when DEBUG=False.

example_app/tutorial/wsgi.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
1515
"""
1616
import os
17-
17+
import sys
18+
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../../')
1819
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tutorial.settings")
1920

2021
# This application object is used by any WSGI server configured to use this

requirements.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Django==1.10.4
2-
djangorestframework==3.5.3
3-
coreapi==2.1.1
4-
openapi-codec==1.2.1
1+
Django==1.10.6
2+
djangorestframework==3.6.0
3+
coreapi==2.3.0
4+
openapi-codec==1.3.1
55
simplejson==3.9.0
66

77
# Testing
@@ -16,3 +16,5 @@ mkdocs==0.15.3
1616
# Heroku
1717
dj_database_url==0.4.1
1818
psycopg2==2.6.2
19+
gunicorn==19.7.0
20+
whitenoise==3.3.0

runtime.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-3.5.2
1+
python-3.6.0

setup.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
name='django-rest-swagger',
4444
version=VERSION,
4545
install_requires=[
46-
'coreapi>=2.1.1',
47-
'openapi-codec>=1.2.1',
48-
'djangorestframework>=3.5.3',
46+
'coreapi>=2.3.0',
47+
'openapi-codec>=1.3.1',
48+
'djangorestframework>=3.5.4',
4949
'simplejson'
5050
],
5151
packages=['rest_framework_swagger'],
@@ -72,6 +72,7 @@
7272
'Programming Language :: Python :: 3',
7373
'Programming Language :: Python :: 2.7',
7474
'Programming Language :: Python :: 3.5',
75+
'Programming Language :: Python :: 3.6',
7576
'Topic :: Internet :: WWW/HTTP',
7677
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
7778
],

tox.ini

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22
skipsdist=True
33
envlist =
44
latest
5-
{py27,py35}-django{18,19,110,111}-drf35
5+
{py27,py35,py36}-django{18,19,110,111}-drf{35,36}
66
lint
77

88
[testenv]
9-
commands = python runtests.py
9+
commands = ./runtests.py
1010
deps =
1111
coreapi
1212
coverage
1313
mock
1414
openapi-codec
1515
simplejson
1616
drf35: djangorestframework>=3.5.3,<3.6
17+
drf36: djangorestframework>=3.6.0,<3.7
1718
django18: Django>=1.8,<1.9
1819
django19: Django>=1.9,<1.10
1920
django110: Django>=1.10,<1.11
@@ -31,9 +32,6 @@ deps =
3132
djangorestframework
3233

3334

34-
[testenv:py27]
35-
commands = python runtests.py
36-
3735
[testenv:lint]
3836
commands = pylint rest_framework_swagger tests
3937
deps = -rrequirements.txt

0 commit comments

Comments
 (0)