Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/sapnamysore/tlt 3253/upgrade django #44

Merged

Conversation

sapnamysore
Copy link
Contributor

@sapnamysore sapnamysore commented Feb 5, 2018

Depends on https://github.com/Harvard-University-iCommons/django-canvas-lti-school-permissions/pull/11

Note: Do not merge till we have done some testing for a bit

@sapnamysore
Copy link
Contributor Author

Copy link
Contributor

@bermudezjd bermudezjd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just a few changes and minor suggestions.

Django==1.9.12
cx-Oracle==5.2.1
Django==1.11.9
cx-Oracle==6.0.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest version of cx_Oracle is now 6.1 I believe

git+ssh://[email protected]/Harvard-University-iCommons/[email protected]#egg=django-auth-lti==1.2.9

# NOTE: Including the django-pgjson library here. This is required by 'async' within django-icommons-common, but
# there is fix for a bug for django<=1.10 , thgat is still in a commit but is not in the released version. Unable to specify
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor spelling error for that

url = "%s://%s%s" % (request.scheme, request.get_host(),
reverse('lti_launch', exclude_resource_link_id=True))

if request.is_secure():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, for our hosted apps, this will always be true since we have a redirect in nginx from http to https.

else:
host = 'http://' + request.get_host()

url = host + reverse('lti_launch')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think that we'd always want our tool launch urls (this one, at least) to be over ssl. IIRC, Canvas prefers/demands that LTI tools be running over secure connections - maybe it's actually browsers that enforce that due to mixed content warnings/errors. In any case, I'd be tempted to simply make the url https here.

@@ -15,3 +16,9 @@
url(r'^not_authorized$', icommons_ui_views.not_authorized, name='not_authorized'),
url(r'^tool_config$', views.tool_config, name='tool_config'),
]

if settings.DEBUG:
import debug_toolbar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add put this in a try/except block? We normally don't require the toolbar in our aws environments, although we might want to run in DEBUG mode on a non-prod deployed instance.

Django==1.9.12
cx-Oracle==5.2.1
Django==1.11.9
cx-Oracle==6.0.3
django-cached-authentication-middleware==0.2.1
django-redis-cache==1.7.1
hiredis==0.2.0
kitchen==1.2.4
ndg-httpsclient==0.4.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind removing the ndg-httpsclient library? We don't need it on Xenial.

# NOTE: Including the django-pgjson library here. This is required by 'async' within django-icommons-common, but
# there is fix for a bug for django<=1.10 , thgat is still in a commit but is not in the released version. Unable to specify
# a commit in the django-icommons-common's setup.py, hence including it in the consuming app till we used switch from pjson to standard json
git+ssh://[email protected]/djangonauts/django-pgjson.git@30463d210a42b2de#egg=django-pgjson
Copy link
Contributor

@Chris-Thornton-Harvard Chris-Thornton-Harvard Feb 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version of pgjson uses import_by_path which is deprecated in Django 1.10+. Causes the deploy to fail.
djangonauts/django-pgjson@30463d210a42b2de#diff-09ac573aadd5de6bf33fc0a97964399a

djangonauts/django-pgjson#45

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Chris-Thornton-Harvard : So the latest Release (tagged 0.31) of django-pgjson from July 2015 ((https://github.com/djangonauts/django-pgjson/releases/tag/0.3.1) uses the deprecated import_by_path. The second link you have is the reported issue, but is still open.

I found the link to this particular commit - which a workaround to this issue(Details in the last comment here djangonauts/django-pgjson#43 ), it has been merged to master but not ben tagged. It worked locally for me, will check why it's failing while we deploy to dev. Thanks for catching it.

@sapnamysore
Copy link
Contributor Author

@bermudezjd : Made some changes based on the PR feedback.

Copy link
Contributor

@bermudezjd bermudezjd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor nitpicks which would be nice to address, but looks good enough to merge.

reverse('lti_launch', exclude_resource_link_id=True))

host = 'https://' + request.get_host()
url = host + reverse('lti_launch')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, although using string formatting reads better to me because I can more easily visualize the resulting string. That said, it's equivalent to the concats in place so no pressure to change:
url = "https://{0}{1}".format(request.get_host(), reverse('lti_launch'))

@@ -15,3 +16,13 @@
url(r'^not_authorized$', icommons_ui_views.not_authorized, name='not_authorized'),
url(r'^tool_config$', views.tool_config, name='tool_config'),
]

try:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move the try block under the if?

url(r'^__debug__/', include(debug_toolbar.urls)),
]
except:
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to have a small comment here so we can remember why we don't care about handling this exception in case we revisit the file.

Copy link
Contributor

@cmurtaugh cmurtaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Chris-Thornton-Harvard Chris-Thornton-Harvard merged commit 1784f2e into develop Mar 8, 2018
@Chris-Thornton-Harvard Chris-Thornton-Harvard deleted the task/sapnamysore/tlt-3253/upgrade-django branch April 11, 2018 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants