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
8156f6eb
Commit
8156f6eb
authored
Aug 31, 2016
by
Tyler Hallada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade Django to 1.9 and update reqs to latest
parent
c9a9e490
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
79 additions
and
82 deletions
+79
-82
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
+24
-22
analyticsdataserver/urls.py
+6
-7
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 @
8156f6eb
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 @
8156f6eb
...
...
@@ -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 @
8156f6eb
...
...
@@ -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 @
8156f6eb
...
...
@@ -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 @
8156f6eb
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 @
8156f6eb
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 @
8156f6eb
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 @
8156f6eb
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 @
8156f6eb
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 @
8156f6eb
...
...
@@ -140,28 +140,30 @@ FIXTURE_DIRS = (
########## TEMPLATE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
TEMPLATE_CONTEXT_PROCESSORS
=
(
'django.contrib.auth.context_processors.auth'
,
'django.core.context_processors.debug'
,
'django.core.context_processors.i18n'
,
'django.core.context_processors.media'
,
'django.core.context_processors.static'
,
'django.core.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'
)),
)
# 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'
:
[
# Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
# list if you haven't customized them:
'django.contrib.auth.context_processors.auth'
,
'django.template.context_processors.debug'
,
'django.template.context_processors.i18n'
,
'django.template.context_processors.media'
,
'django.template.context_processors.static'
,
'django.template.context_processors.tz'
,
'django.contrib.messages.context_processors.messages'
,
'django.template.context_processors.request'
,
],
},
}
]
########## END TEMPLATE CONFIGURATION
...
...
analyticsdataserver/urls.py
View file @
8156f6eb
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
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-auth/'
,
include
(
'rest_framework.urls'
,
'rest_framework'
)),
url
(
r'^api-token-auth/'
,
'rest_framework.authtoken.views.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 @
8156f6eb
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 @
8156f6eb
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 @
8156f6eb
newrelic==2.
40.0.34
newrelic==2.
68.0.50
requirements/production.txt
View file @
8156f6eb
...
...
@@ -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 @
8156f6eb
# 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