Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 12e1806

Browse files
authored
feat: revert back to django 2.2 (#465)
1 parent 5537147 commit 12e1806

14 files changed

Lines changed: 131 additions & 184 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ matrix:
2020
- python: '3.8'
2121
env: TESTNAME=test-python-3.8 TARGETS="PYTHON_ENV=py38 main.test"
2222
- python: '3.8'
23-
env: TESTNAME=test-python-3.8-django-3.0 TARGETS="PYTHON_ENV=py38 DJANGO_VERSION=django32 main.test"
23+
env: TESTNAME=test-python-3.8-django-3.0 TARGETS="PYTHON_ENV=py38 DJANGO_VERSION=django30 main.test"
2424
after_success:
2525
- docker exec analytics_api_testing /edx/app/analytics_api/analytics_api/.travis/run_coverage.sh
2626
- codecov --disable pycov

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ COVERAGE_DIR = $(ROOT)/build/coverage
33
PACKAGES = analyticsdataserver analytics_data_api
44
DATABASES = default analytics
55
PYTHON_ENV=py38
6-
DJANGO_VERSION=django32
6+
DJANGO_VERSION=django22
77
.DEFAULT_GOAL := help
88

99
help: ## display this help message

analyticsdataserver/settings/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,7 @@
245245
'rest_framework.authtoken',
246246
'rest_framework_jwt',
247247
'django_countries',
248-
'drf_yasg',
249-
'edx_api_doc_tools',
248+
'rest_framework_swagger',
250249
'storages',
251250
'enterprise_data',
252251
'rules.apps.AutodiscoverRulesConfig',

analyticsdataserver/urls.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,21 @@
11
from django.conf.urls import include, url
22
from django.contrib import admin
33
from django.views.generic import RedirectView
4-
from edx_api_doc_tools import make_api_info, make_docs_ui_view
54
from rest_framework.authtoken.views import obtain_auth_token
65

76
from analyticsdataserver import views
87

98
admin.site.site_header = 'Analytics Data API Service Administration'
109
admin.site.site_title = admin.site.site_header
1110

12-
api_ui_view = make_docs_ui_view(
13-
make_api_info(
14-
title="edX Analytics Data API",
15-
version="v1",
16-
email="program-cosmonauts@edx.org"
17-
)
18-
)
19-
2011
urlpatterns = [
2112
url(r'^$', RedirectView.as_view(url='/docs')), # pylint: disable=no-value-for-parameter
2213

2314
url(r'^api-auth/', include('rest_framework.urls', 'rest_framework')),
2415
url(r'^api-token-auth/', obtain_auth_token),
2516

2617
url(r'^api/', include('analytics_data_api.urls')),
27-
url(r'^docs/$', api_ui_view, name='api-docs'),
18+
url(r'^docs/', views.SwaggerSchemaView.as_view()),
2819
url(r'^status/$', views.StatusView.as_view(), name='status'),
2920
url(r'^authenticated/$', views.AuthenticationTestView.as_view(), name='authenticated'),
3021
url(r'^health/$', views.HealthView.as_view(), name='health'),

analyticsdataserver/views.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
from django.conf import settings
44
from django.db import connections
55
from django.http import HttpResponse
6-
from rest_framework import permissions
6+
from rest_framework import permissions, schemas
7+
from rest_framework.permissions import AllowAny
78
from rest_framework.renderers import JSONRenderer
89
from rest_framework.response import Response
910
from rest_framework.views import APIView
11+
from rest_framework_swagger.renderers import OpenAPIRenderer, SwaggerUIRenderer
1012

1113
logger = logging.getLogger(__name__)
1214

@@ -31,6 +33,21 @@ def _handle_error(status_code):
3133
return HttpResponse(renderer.render(info), content_type=content_type, status=status_code)
3234

3335

36+
class SwaggerSchemaView(APIView):
37+
"""
38+
Renders the swagger schema for the documentation regardless of permissions.
39+
"""
40+
permission_classes = [AllowAny]
41+
renderer_classes = [
42+
OpenAPIRenderer,
43+
SwaggerUIRenderer
44+
]
45+
46+
def get(self, _request):
47+
generator = schemas.SchemaGenerator(title='Analytics API')
48+
return Response(generator.get_schema())
49+
50+
3451
class StatusView(APIView):
3552
"""
3653
Simple check to determine if the server is alive

requirements/base.in

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22

33
-c constraints.txt
44

5-
edx-api-doc-tools
65
boto==2.42.0 # MIT
76
boto3
8-
coreapi
97
Django # BSD License
108
django-countries # MIT
119
python-memcached # Python Software Foundation License v2
1210
djangorestframework # BSD
11+
django-rest-swagger # BSD
1312
djangorestframework-csv # BSD
1413
django-storages # BSD
1514
elasticsearch-dsl # Apache 2.0
1615
ordered-set # MIT
1716
tqdm # MIT
1817
urllib3 # MIT
19-
Markdown # BSD:markdown is used by swagger for rendering the api docs
18+
Markdown==2.6.6 # BSD:markdown is used by swagger for rendering the api docs
2019
edx-ccx-keys
2120
edx-django-release-util
2221
edx-opaque-keys

requirements/base.txt

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#
55
# make upgrade
66
#
7-
asgiref==3.4.1
8-
# via django
97
boto==2.42.0
108
# via -r requirements/base.in
119
boto3==1.18.12
@@ -24,18 +22,17 @@ charset-normalizer==2.0.4
2422
# via requests
2523
coreapi==2.3.3
2624
# via
27-
# -r requirements/base.in
28-
# drf-yasg
25+
# django-rest-swagger
26+
# openapi-codec
2927
coreschema==0.0.4
30-
# via
31-
# coreapi
32-
# drf-yasg
28+
# via coreapi
3329
cryptography==3.4.7
3430
# via
3531
# django-fernet-fields
3632
# pyjwt
37-
django==3.2.6
33+
django==2.2.24
3834
# via
35+
# -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt
3936
# -r requirements/base.in
4037
# django-cors-headers
4138
# django-crum
@@ -44,8 +41,6 @@ django==3.2.6
4441
# django-storages
4542
# djangorestframework
4643
# drf-jwt
47-
# drf-yasg
48-
# edx-api-doc-tools
4944
# edx-django-release-util
5045
# edx-django-utils
5146
# edx-drf-extensions
@@ -66,6 +61,8 @@ django-model-utils==4.1.1
6661
# via
6762
# edx-enterprise-data
6863
# edx-rbac
64+
django-rest-swagger==2.2.0
65+
# via -r requirements/base.in
6966
django-storages==1.8
7067
# via
7168
# -c requirements/constraints.txt
@@ -77,20 +74,17 @@ django-waffle==2.2.1
7774
djangorestframework==3.12.4
7875
# via
7976
# -r requirements/base.in
77+
# django-rest-swagger
8078
# djangorestframework-csv
8179
# drf-jwt
82-
# drf-yasg
83-
# edx-api-doc-tools
8480
# edx-drf-extensions
8581
# rest-condition
8682
djangorestframework-csv==2.1.1
8783
# via -r requirements/base.in
88-
drf-jwt==1.19.1
89-
# via edx-drf-extensions
90-
drf-yasg==1.20.0
91-
# via edx-api-doc-tools
92-
edx-api-doc-tools==1.4.3
93-
# via -r requirements/base.in
84+
drf-jwt==1.19.0
85+
# via
86+
# -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt
87+
# edx-drf-extensions
9488
edx-ccx-keys==1.2.1
9589
# via -r requirements/base.in
9690
edx-django-release-util==1.1.0
@@ -131,8 +125,6 @@ future==0.18.2
131125
# via pyjwkest
132126
idna==3.2
133127
# via requests
134-
inflection==0.5.1
135-
# via drf-yasg
136128
itypes==1.2.0
137129
# via coreapi
138130
jinja2==3.0.1
@@ -141,18 +133,18 @@ jmespath==0.10.0
141133
# via
142134
# boto3
143135
# botocore
144-
markdown==3.3.4
136+
markdown==2.6.6
145137
# via -r requirements/base.in
146138
markupsafe==2.0.1
147139
# via jinja2
148140
newrelic==6.6.0.162
149141
# via edx-django-utils
142+
openapi-codec==1.3.2
143+
# via django-rest-swagger
150144
ordered-set==3.1.1
151145
# via
152146
# -c requirements/constraints.txt
153147
# -r requirements/base.in
154-
packaging==21.0
155-
# via drf-yasg
156148
pbr==5.6.0
157149
# via stevedore
158150
psutil==5.8.0
@@ -163,14 +155,13 @@ pycryptodomex==3.10.1
163155
# via pyjwkest
164156
pyjwkest==1.4.2
165157
# via edx-drf-extensions
166-
pyjwt[crypto]==2.1.0
158+
pyjwt[crypto]==1.7.1
167159
# via
160+
# -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt
168161
# drf-jwt
169162
# edx-rest-api-client
170163
pymongo==3.12.0
171164
# via edx-opaque-keys
172-
pyparsing==2.4.7
173-
# via packaging
174165
python-dateutil==2.8.2
175166
# via
176167
# botocore
@@ -192,16 +183,14 @@ requests==2.26.0
192183
# slumber
193184
rest-condition==1.0.3
194185
# via edx-drf-extensions
195-
ruamel.yaml==0.17.10
196-
# via drf-yasg
197-
ruamel.yaml.clib==0.2.6
198-
# via ruamel.yaml
199186
rules==3.0
200187
# via edx-enterprise-data
201188
s3transfer==0.5.0
202189
# via boto3
203190
semantic-version==2.8.5
204191
# via edx-drf-extensions
192+
simplejson==3.17.3
193+
# via django-rest-swagger
205194
six==1.16.0
206195
# via
207196
# djangorestframework-csv
@@ -226,9 +215,7 @@ tqdm==4.62.0
226215
unicodecsv==0.14.1
227216
# via djangorestframework-csv
228217
uritemplate==3.0.1
229-
# via
230-
# coreapi
231-
# drf-yasg
218+
# via coreapi
232219
urllib3==1.26.6
233220
# via
234221
# -r requirements/base.in

requirements/constraints.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
# pin when possible. Writing an issue against the offending project and
99
# linking to it here is good.
1010

11+
# Common constraints for edx repos
12+
-c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt
13+
1114
# TODO: Many pinned dependencies should be unpinned and/or moved to this constraints file.
1215

1316
# django-storages version 1.9 drops support for boto storage backend.

0 commit comments

Comments
 (0)