Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-data-api
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-analytics-data-api
Commits
390b6975
Commit
390b6975
authored
Sep 01, 2016
by
Tyler Hallada
Committed by
GitHub
Sep 01, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #137 from edx/thallada/django-1.9-upgrade
Upgrade to Django 1.9
parents
c9a9e490
66fa8c4a
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
77 additions
and
87 deletions
+77
-87
analytics_data_api/urls.py
+4
-5
analytics_data_api/v0/apps.py
+2
-2
analytics_data_api/v0/tests/test_connections.py
+1
-1
analytics_data_api/v0/tests/test_urls.py
+1
-1
analytics_data_api/v0/urls/__init__.py
+7
-8
analytics_data_api/v0/urls/courses.py
+2
-2
analytics_data_api/v0/urls/learners.py
+3
-4
analytics_data_api/v0/urls/problems.py
+4
-5
analytics_data_api/v0/urls/videos.py
+2
-2
analyticsdataserver/settings/base.py
+20
-23
analyticsdataserver/settings/local.py
+0
-3
analyticsdataserver/urls.py
+8
-8
analyticsdataserver/wsgi.py
+1
-1
requirements/base.txt
+7
-7
requirements/optional.txt
+1
-1
requirements/production.txt
+2
-2
requirements/test.txt
+12
-12
No files found.
analytics_data_api/urls.py
View file @
390b6975
from
django.conf.urls
import
patterns
,
url
,
include
from
django.conf.urls
import
url
,
include
from
rest_framework.urlpatterns
import
format_suffix_patterns
urlpatterns
=
patterns
(
''
,
url
(
r'^v0/'
,
include
(
'analytics_data_api.v0.urls'
,
namespace
=
'v0'
)),
)
urlpatterns
=
[
url
(
r'^v0/'
,
include
(
'analytics_data_api.v0.urls'
,
'v0'
)),
]
urlpatterns
=
format_suffix_patterns
(
urlpatterns
)
analytics_data_api/v0/apps.py
View file @
390b6975
...
...
@@ -2,14 +2,14 @@ from django.apps import AppConfig
from
django.conf
import
settings
from
elasticsearch_dsl
import
connections
from
analytics_data_api.utils
import
load_fully_qualified_definition
class
ApiAppConfig
(
AppConfig
):
name
=
'analytics_data_api.v0'
def
ready
(
self
):
from
analytics_data_api.utils
import
load_fully_qualified_definition
super
(
ApiAppConfig
,
self
)
.
ready
()
if
settings
.
ELASTICSEARCH_LEARNERS_HOST
:
connection_params
=
{
'hosts'
:
[
settings
.
ELASTICSEARCH_LEARNERS_HOST
]}
...
...
analytics_data_api/v0/tests/test_connections.py
View file @
390b6975
...
...
@@ -33,7 +33,7 @@ class ESConnectionTests(TestCase):
self
.
assertTrue
(
'my_access_key'
in
auth_header
)
def
test_timeout
(
self
):
def
fake_connection
(
_address
):
def
fake_connection
(
*
args
):
# pylint: disable=unused-argument
raise
socket
.
timeout
(
'fake error'
)
socket
.
create_connection
=
fake_connection
connection
=
ESConnection
(
'mockservice.cc-zone-1.amazonaws.com'
,
...
...
analytics_data_api/v0/tests/test_urls.py
View file @
390b6975
...
...
@@ -6,7 +6,7 @@ class UrlRedirectTests(TestCase):
api_root_path
=
'/api/v0/'
def
assertRedirectsToRootPath
(
self
,
path
,
**
kwargs
):
assert_kwargs
=
{
'status_code'
:
30
1
}
assert_kwargs
=
{
'status_code'
:
30
2
}
assert_kwargs
.
update
(
kwargs
)
p
=
'{0}{1}/'
.
format
(
self
.
api_root_path
,
path
)
...
...
analytics_data_api/v0/urls/__init__.py
View file @
390b6975
from
django.conf.urls
import
patterns
,
url
,
include
from
django.conf.urls
import
url
,
include
from
django.core.urlresolvers
import
reverse_lazy
from
django.views.generic
import
RedirectView
COURSE_ID_PATTERN
=
r'(?P<course_id>[^/+]+[/+][^/+]+[/+][^/]+)'
urlpatterns
=
patterns
(
''
,
url
(
r'^courses/'
,
include
(
'analytics_data_api.v0.urls.courses'
,
namespace
=
'courses'
)),
url
(
r'^problems/'
,
include
(
'analytics_data_api.v0.urls.problems'
,
namespace
=
'problems'
)),
url
(
r'^videos/'
,
include
(
'analytics_data_api.v0.urls.videos'
,
namespace
=
'videos'
)),
url
(
'^'
,
include
(
'analytics_data_api.v0.urls.learners'
,
namespace
=
'learners'
)),
urlpatterns
=
[
url
(
r'^courses/'
,
include
(
'analytics_data_api.v0.urls.courses'
,
'courses'
)),
url
(
r'^problems/'
,
include
(
'analytics_data_api.v0.urls.problems'
,
'problems'
)),
url
(
r'^videos/'
,
include
(
'analytics_data_api.v0.urls.videos'
,
'videos'
)),
url
(
'^'
,
include
(
'analytics_data_api.v0.urls.learners'
,
'learners'
)),
# pylint: disable=no-value-for-parameter
url
(
r'^authenticated/$'
,
RedirectView
.
as_view
(
url
=
reverse_lazy
(
'authenticated'
)),
name
=
'authenticated'
),
url
(
r'^health/$'
,
RedirectView
.
as_view
(
url
=
reverse_lazy
(
'health'
)),
name
=
'health'
),
url
(
r'^status/$'
,
RedirectView
.
as_view
(
url
=
reverse_lazy
(
'status'
)),
name
=
'status'
),
)
]
analytics_data_api/v0/urls/courses.py
View file @
390b6975
from
django.conf.urls
import
patterns
,
url
from
django.conf.urls
import
url
from
analytics_data_api.v0.urls
import
COURSE_ID_PATTERN
from
analytics_data_api.v0.views
import
courses
as
views
...
...
@@ -21,4 +21,4 @@ urlpatterns = []
for
path
,
view
,
name
in
COURSE_URLS
:
regex
=
r'^{0}/{1}/$'
.
format
(
COURSE_ID_PATTERN
,
path
)
urlpatterns
+=
patterns
(
''
,
url
(
regex
,
view
.
as_view
(),
name
=
name
))
urlpatterns
.
append
(
url
(
regex
,
view
.
as_view
(),
name
=
name
))
analytics_data_api/v0/urls/learners.py
View file @
390b6975
from
django.conf.urls
import
patterns
,
url
from
django.conf.urls
import
url
from
analytics_data_api.v0.urls
import
COURSE_ID_PATTERN
from
analytics_data_api.v0.views
import
learners
as
views
USERNAME_PATTERN
=
r'(?P<username>[\w.+-]+)'
urlpatterns
=
patterns
(
''
,
urlpatterns
=
[
url
(
r'^learners/$'
,
views
.
LearnerListView
.
as_view
(),
name
=
'learners'
),
url
(
r'^learners/{}/$'
.
format
(
USERNAME_PATTERN
),
views
.
LearnerView
.
as_view
(),
name
=
'learner'
),
url
(
r'^engagement_timelines/{}/$'
.
format
(
USERNAME_PATTERN
),
views
.
EngagementTimelineView
.
as_view
(),
name
=
'engagement_timelines'
),
url
(
r'^course_learner_metadata/{}/$'
.
format
(
COURSE_ID_PATTERN
),
views
.
CourseLearnerMetadata
.
as_view
(),
name
=
'course_learner_metadata'
),
)
]
analytics_data_api/v0/urls/problems.py
View file @
390b6975
import
re
from
django.conf.urls
import
patterns
,
url
from
django.conf.urls
import
url
from
analytics_data_api.v0.views
import
problems
as
views
...
...
@@ -9,11 +9,10 @@ PROBLEM_URLS = [
(
'grade_distribution'
,
views
.
GradeDistributionView
,
'grade_distribution'
),
]
urlpatterns
=
patterns
(
''
,
urlpatterns
=
[
url
(
r'^(?P<module_id>.+)/sequential_open_distribution/$'
,
views
.
SequentialOpenDistributionView
.
as_view
(),
name
=
'sequential_open_distribution'
),
)
]
for
path
,
view
,
name
in
PROBLEM_URLS
:
urlpatterns
+=
patterns
(
''
,
url
(
r'^(?P<problem_id>.+)/'
+
re
.
escape
(
path
)
+
r'/$'
,
view
.
as_view
(),
name
=
name
))
urlpatterns
.
append
(
url
(
r'^(?P<problem_id>.+)/'
+
re
.
escape
(
path
)
+
r'/$'
,
view
.
as_view
(),
name
=
name
))
analytics_data_api/v0/urls/videos.py
View file @
390b6975
import
re
from
django.conf.urls
import
patterns
,
url
from
django.conf.urls
import
url
from
analytics_data_api.v0.views
import
videos
as
views
...
...
@@ -11,4 +11,4 @@ VIDEO_URLS = [
urlpatterns
=
[]
for
path
,
view
,
name
in
VIDEO_URLS
:
urlpatterns
+=
patterns
(
''
,
url
(
r'^(?P<video_id>.+)/'
+
re
.
escape
(
path
)
+
r'/$'
,
view
.
as_view
(),
name
=
name
))
urlpatterns
.
append
(
url
(
r'^(?P<video_id>.+)/'
+
re
.
escape
(
path
)
+
r'/$'
,
view
.
as_view
(),
name
=
name
))
analyticsdataserver/settings/base.py
View file @
390b6975
...
...
@@ -20,9 +20,6 @@ SITE_NAME = basename(DJANGO_ROOT)
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG
=
False
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG
=
DEBUG
########## END DEBUG CONFIGURATION
...
...
@@ -140,28 +137,28 @@ FIXTURE_DIRS = (
########## TEMPLATE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
TEMPLATE_CONTEXT_PROCESSORS
=
(
# See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATES
TEMPLATES
=
[
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[
normpath
(
join
(
SITE_ROOT
,
'templates'
)),
],
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'context_processors'
:
[
'django.contrib.auth.context_processors.auth'
,
'django.cor
e.context_processors.debug'
,
'django.cor
e.context_processors.i18n'
,
'django.cor
e.context_processors.media'
,
'django.cor
e.context_processors.static'
,
'django.cor
e.context_processors.tz'
,
'django.templat
e.context_processors.debug'
,
'django.templat
e.context_processors.i18n'
,
'django.templat
e.context_processors.media'
,
'django.templat
e.context_processors.static'
,
'django.templat
e.context_processors.tz'
,
'django.contrib.messages.context_processors.messages'
,
'django.core.context_processors.request'
,
)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
TEMPLATE_LOADERS
=
(
'django.template.loaders.filesystem.Loader'
,
'django.template.loaders.app_directories.Loader'
,
)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
TEMPLATE_DIRS
=
(
normpath
(
join
(
SITE_ROOT
,
'templates'
)),
)
'django.template.context_processors.request'
,
],
},
}
]
########## END TEMPLATE CONFIGURATION
...
...
analyticsdataserver/settings/local.py
View file @
390b6975
...
...
@@ -9,9 +9,6 @@ from analyticsdataserver.settings.base import *
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG
=
True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG
=
DEBUG
########## END DEBUG CONFIGURATION
...
...
analyticsdataserver/urls.py
View file @
390b6975
from
django.conf
import
settings
from
django.conf.urls
import
patterns
,
include
,
url
from
django.conf.urls
import
include
,
url
from
django.contrib
import
admin
from
django.views.generic
import
RedirectView
from
analyticsdataserver
import
views
from
rest_framework.authtoken.views
import
obtain_auth_token
urlpatterns
=
patterns
(
''
,
urlpatterns
=
[
url
(
r'^$'
,
RedirectView
.
as_view
(
url
=
'/docs'
)),
# pylint: disable=no-value-for-parameter
url
(
r'^api-auth/'
,
include
(
'rest_framework.urls'
,
namespace
=
'rest_framework'
)),
url
(
r'^api-token-auth/'
,
'rest_framework.authtoken.views.obtain_auth_token'
),
url
(
r'^api-auth/'
,
include
(
'rest_framework.urls'
,
'rest_framework'
)),
url
(
r'^api-token-auth/'
,
obtain_auth_token
),
url
(
r'^api/'
,
include
(
'analytics_data_api.urls'
,
namespace
=
'api'
)),
url
(
r'^api/'
,
include
(
'analytics_data_api.urls'
,
'api'
)),
url
(
r'^docs/'
,
include
(
'rest_framework_swagger.urls'
)),
url
(
r'^status/$'
,
views
.
StatusView
.
as_view
(),
name
=
'status'
),
url
(
r'^authenticated/$'
,
views
.
AuthenticationTestView
.
as_view
(),
name
=
'authenticated'
),
url
(
r'^health/$'
,
views
.
HealthView
.
as_view
(),
name
=
'health'
),
)
]
if
settings
.
ENABLE_ADMIN_SITE
:
# pragma: no cover
admin
.
autodiscover
()
urlpatterns
+=
patterns
(
''
,
url
(
r'^site/admin/'
,
include
(
admin
.
site
.
urls
)))
urlpatterns
.
append
(
url
(
r'^site/admin/'
,
include
(
admin
.
site
.
urls
)))
handler500
=
'analyticsdataserver.views.handle_internal_server_error'
# pylint: disable=invalid-name
handler404
=
'analyticsdataserver.views.handle_missing_resource_error'
# pylint: disable=invalid-name
analyticsdataserver/wsgi.py
View file @
390b6975
import
os
from
django.core.wsgi
import
get_wsgi_application
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
...
...
@@ -9,7 +10,6 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "analyticsdataserver.settings.pr
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from
django.core.wsgi
import
get_wsgi_application
application
=
get_wsgi_application
()
# pylint: disable=invalid-name
# Apply WSGI middleware here.
...
...
requirements/base.txt
View file @
390b6975
boto==2.
22.1
# MIT
Django==1.
8.14
# BSD License
django-model-utils==2.2 # BSD
boto==2.
42.0
# MIT
Django==1.
9.9
# BSD License
django-model-utils==2.
5.
2 # BSD
djangorestframework==3.4.6 # BSD
django-rest-swagger==0.
2
.8 # BSD
djangorestframework-csv==1.
3.3
# BSD
django-countries==
3.2
# MIT
django-rest-swagger==0.
3
.8 # BSD
djangorestframework-csv==1.
4.1
# BSD
django-countries==
4.0
# MIT
edx-django-release-util==0.1.0
elasticsearch-dsl==0.0.11 # Apache 2.0
# markdown is used by swagger for rendering the api docs
Markdown==2.6 # BSD
Markdown==2.6
.6
# BSD
-e git+https://github.com/edx/opaque-keys.git@d45d0bd8d64c69531be69178b9505b5d38806ce0#egg=opaque-keys
requirements/optional.txt
View file @
390b6975
newrelic==2.
40.0.34
newrelic==2.
68.0.50
requirements/production.txt
View file @
390b6975
...
...
@@ -4,5 +4,5 @@
MySQL-python==1.2.5 # GPL License
PyYAML==3.11 # MIT
gunicorn==
0.17.4
# MIT
path.py==
5.2
# MIT
gunicorn==
19.6.0
# MIT
path.py==
8.2.1
# MIT
requirements/test.txt
View file @
390b6975
# Test dependencies go here.
-r base.txt
coverage==
3.7.1
ddt==1.
0.1
diff-cover >= 0.
2.1
django-dynamic-fixture==1.
8.1
django-nose==1.4.
3
mock==
1.0.1
nose-exclude==0.
2.0
coverage==
4.2
ddt==1.
1.0
diff-cover >= 0.
9.9
django-dynamic-fixture==1.
9.0
django-nose==1.4.
4
mock==
2.0.0
nose-exclude==0.
4.1
nose-ignore-docstring==0.2
nose==1.3.
4
pep257==0.
4.1
pep8==1.
6
.0
pylint==1.
5.0
pytz==201
4.10
nose==1.3.
7
pep257==0.
7.0
pep8==1.
7
.0
pylint==1.
6.4
pytz==201
6.6.1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment