-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdjango.txt
123 lines (82 loc) · 3.92 KB
/
django.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
Building Tsugi Applications in Django
-------------------------------------
Make an account on
www.pythonanywhere.com
Start a shell on PythonAnywhere and run these commands:
cd
mkvirtualenv django2 --python=/usr/bin/python3.6
workon django2
pip install django==2.1.7
We install an earlier version of Django to make sure
that the vesion of SQLite works with your Django.
Verify things worked by checing the Django version:
python3 -m django --version
git clone https://github.com/tsugiproject/djtest
cd djtest
pip install -r requirements.txt
Then create the needed database file:
python3 manage.py migrate
Edit the file djtest/settings.py and make sure that the the
keyset url is pointing to the right server and the TSUGI_PROXY
is set as shown below:
TSUGI_KEYSET = "https://dev1.tsugicloud.org/tsugi/lti/keyset-ext"
TSUGI_PROXY = 'proxy.server:3128'
The TSUGI_PROXY value is only needed for PythonAnywhere for free
accounts. If you set this up on your own hosting environment
or pay for your PythonAnywhere account, this is not necessary.
In the PYAW web interface navigate to the Web tab to create a new
web application. If you have not already done so, add a new web
application. Select manual configuration and Python 3.6. Once the
webapp is created, you need to make a few changes to the settings
for the web app and your application.
Create a duplicate tab in the current web browser with shell open.
In the duplicate tab in top right corner click on the three line
drop down and select Web. Click on Add a new web app. Click next
until you get to Select a Python Web Framework. Select Manual
Configuration. Select the Python version to be Python 3.6.
Click Next to finish Manual Configuration for Web App.
source code: /home/--your-account---/djtest
working directory: /home/--your-account---/djtest
virtualenv: /home/--your-account---/.virtualenvs/django2
Then edit the WGSI Configuration File and replace the contents of the file
with the following code:
import os
import sys
path = os.path.expanduser('~/djtest')
if path not in sys.path:
sys.path.insert(0, path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'djtest.settings'
from django.core.wsgi import get_wsgi_application
from django.contrib.staticfiles.handlers import StaticFilesHandler
application = StaticFilesHandler(get_wsgi_application())
Then restart your web application and attempt to go
https://--your-account--.pythonanywhere.com/grade/launch/
You should get redirected to an error detail page on
www.tsugi.org since this is the launch URL.
https://djtools.tsugicloud.org/grade/launch/
Adding to to an instance of Tsugi.
https://dev1.tsugicloud.org/tsugi/admin
Enter the password "tsugi" and select "Manage External Tools" and "Add Tool".
The "Launch Endpoint" must be unique across the whole system. The simplest thing
is to just use your account name on pythonanywhere. The name of the tool is a title
and can have several words.
The URL for receiving launches needs to be
https://--your-account--.pythonanywhere.com/grade/launch
Here are my sample settings:
Launch endpoint: drchuck
Name of the tool: Dr. Chuck's Test
Launch URL: https://drchuck.pythonanywhere.com/grade/launch
Icon: fa-random
The default for the additional settings is OK for this test. These fields inform the
App Store and Deep Linking. Don't fill in the keys - they are created automatically.
After you save your tool, test launch it from the TsugiCloud store:
https://dev1.tsugicloud.org/tsugi/store/
Find your tool, click on "Details" and then "Test". This
will test launch the tool from within Tsugi.
Launching from an LMS
---------------------
Once this is done, you can use LTI 1.1 or LTI Advantage to launch your tool. In the
Tsugi store you will get the launch url to use in the LMS. You might be able to
use 12345/secret if the Tsugi server still had the default key for testing. The URL
will be something like (depending on your tool registration).
https://dev1.tsugicloud.org/ext/drchuck