You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: v3/docs/developer-overview.md
+7-32Lines changed: 7 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,14 +9,13 @@ Look at the Git history to see when this document was last updated; the more tim
9
9
elapsed since that date, the more likely things are out-of-date.
10
10
11
11
I'm assuming that you're competent in Python, JavaScript, command-line-fu, and Google-fu,
12
+
and general [command-line BS](http://www.pgbovine.net/command-line-bullshittery.htm),
12
13
so I won't do much hand-holding in these directions.
13
14
14
15
This guide isn't meant to be comprehensive; rather, it's just a starting point for learning about the code
15
16
and development workflow. You will undoubtedly still be confused about details after reading it, so
16
17
feel free to email philip@pgbovine.net if you have questions.
17
18
18
-
And please excuse the sloppy writing; I'm not trying to win any style awards here :)
19
-
20
19
21
20
## Getting Started: Running OPT locally on your machine using Bottle:
22
21
@@ -30,41 +29,16 @@ And then run:
30
29
cd OnlinePythonTutor/v3/
31
30
python bottle_server.py
32
31
33
-
(use `python3` if you want to test the Python 3 backend.)
32
+
(Use `python3` if you want to test the Python 3 backend. Note that when you run bottle, you will **always trigger the backend for the version of Python used to invoke it**, so the Python 2/3 toggle selector on the frontend is meaningless. You will also not be able to test other language backends locally.)
33
+
34
34
35
35
If all goes well, when you visit this URL, you should see the Python Tutor visualizer:
36
36
37
37
http://localhost:8080/visualize.html
38
38
39
39
Note that you can run bottle with both Python 2 and 3.
40
40
41
-
However, **only** run this app locally for testing, not in production, since security checks are disabled.
42
-
43
-
44
-
## Alternative: Using Google App Engine (deprecated)
45
-
46
-
When you check out OPT from GitHub, it's configured by default to run on Google App Engine
47
-
(but it can also run fine on a CGI-enabled webserver such as Apache).
48
-
49
-
To run a local instance, download/install
50
-
the Google App Engine [Python SDK](https://developers.google.com/appengine/downloads)
51
-
for your OS and then run:
52
-
53
-
cd OnlinePythonTutor/
54
-
dev_appserver.py v3/
55
-
56
-
Now if you visit http://localhost:8080/ on your browser, you should see the main OPT editor screen.
57
-
58
-
Congrats! Now you can edit any code in `OnlinePythonTutor/v3/` and reload the page to test your changes.
59
-
You don't need to shut down and restart the local webserver after every edit.
60
-
61
-
btw, using the default configuration, http://localhost:8080/ is actually loading the `v3/visualize.html` HTML file.
62
-
(See `v3/pythontutor.py` for details.)
63
-
64
-
The benefit of running OPT locally is that you can test all changes without going online. So even
65
-
if you're eventually going to deploy on something other than Google App Engine, it still makes sense to install locally
66
-
for development and testing. The main caveat here is that Google App Engine currently runs Python 2.7,
67
-
so you won't be able to test Python 3 locally this way.
41
+
However, **only** run this app locally for testing, not in production, since all security checks are disabled.
68
42
69
43
70
44
## Overall system architecture
@@ -114,11 +88,12 @@ app.yaml, pythontutor.py - files for deploying on Google App Engine
114
88
web_exec.py - example CGI script for deploying backend on CGI-enabled webservers
115
89
```
116
90
117
-
The backend works with both Python 2 and 3.
91
+
The backend works with both Python 2 and 3. (Other language backends are located in [v4-cokapi/](https://github.com/pgbovine/OnlinePythonTutor/tree/master/v4-cokapi), not in v3/)
92
+
118
93
119
94
## Hacking the backend
120
95
121
-
To modify the backend, you will mainly need to understand `pg_logger.py` and `pg_encoder.py`.
96
+
To modify the Python backend, you will mainly need to understand `pg_logger.py` and `pg_encoder.py`.
0 commit comments