2021-10-17 15:02:54 +08:00
# EnglishPal - Learn English Words Smartly
2021-07-16 20:09:51 +08:00
Hui Lan < hui.lan @ cantab . net >
1 November 2019
2021-10-17 15:02:54 +08:00
## What is it?
2021-07-16 20:09:51 +08:00
EnglishPal allows the user to build his list of new English words
2021-07-23 14:13:29 +08:00
picked from articles selected for him according his vocabulary level.
2021-07-16 20:09:51 +08:00
2021-10-17 15:02:54 +08:00
## Run it on a local machine
2021-07-16 20:09:51 +08:00
2021-10-17 14:54:48 +08:00
`python3 main.py`
2021-07-16 20:09:51 +08:00
2021-10-17 14:54:48 +08:00
Make sure you have the SQLite database file in `app/static` (see below).
2021-07-16 20:09:51 +08:00
2021-10-17 15:02:54 +08:00
## Run it as a Docker container
2021-07-16 20:09:51 +08:00
2021-10-17 14:54:48 +08:00
Assuming that docker has been installed and that you are a sudo user (i.e., sudoer), start the program by typing the following command in directory `EnglishPal` :
2021-07-16 20:09:51 +08:00
2021-10-17 14:54:48 +08:00
`sudo ./build.sh`
2021-07-16 20:19:42 +08:00
2021-10-17 14:54:48 +08:00
Open your favourite Internet browser and enter this URL address: `http://ip-address:90` .
2021-07-16 20:09:51 +08:00
2021-10-17 15:02:54 +08:00
### Explanation on the commands in build.sh
2021-07-16 20:19:42 +08:00
2021-10-17 14:54:48 +08:00
My steps for deploying English on the server.
2021-07-16 20:09:51 +08:00
2021-10-17 14:54:48 +08:00
- ssh to ubuntu@118.*.*.118
2021-07-16 20:19:42 +08:00
2022-02-05 23:03:43 +08:00
- cd to /home/lanhui/englishpal2/EnglishPal
2021-07-16 20:09:51 +08:00
2021-10-17 14:54:48 +08:00
- Stop all docker service: `sudo service docker restart` . If you know the docker container ID, then the above command is an overkill. Use the following command instead: `sudo docker stop ContainerID` . You could get all container IDs with the following command: `sudo docker ps`
2021-07-16 20:19:42 +08:00
2021-10-17 14:54:48 +08:00
- Rebuild container. Run the following command to rebuild a docker image after the code gets updated: `sudo docker build -t englishpal .`
2021-07-16 20:09:51 +08:00
2021-10-17 14:54:48 +08:00
- Run the application: `sudo docker run -d -p 90:80 -v /home/lanhui/englishpal/app/static/frequency:/app/static/frequency -t englishpal` . If you use `sudo docker run -d -p 90:80 -t englishpal` , data will be lost after terminating the program.
2021-07-16 20:19:42 +08:00
2021-10-17 14:54:48 +08:00
- Save space: `sudo docker system prune -a -f`
2021-07-16 20:09:51 +08:00
2021-07-16 20:19:42 +08:00
2021-10-17 15:02:54 +08:00
### Other useful docker commands
2021-07-16 20:19:42 +08:00
2021-10-17 14:54:48 +08:00
- `sudo docker ps -a`
2021-07-16 20:09:51 +08:00
2021-10-17 14:54:48 +08:00
- `sudo docker logs image_name` , where image_name could be obtained from `sudo docker ps` .
2021-07-16 20:19:42 +08:00
2021-10-17 14:54:48 +08:00
`build.sh` contains all the above commands. Run "sudo ./build.sh" to rebuild and run the web application.
2021-07-16 20:09:51 +08:00
2021-10-17 15:02:54 +08:00
## Importing articles
2021-07-16 20:09:51 +08:00
2021-07-17 09:47:17 +08:00
All articles are stored in the `article` table in a SQLite file called
2021-07-16 20:49:57 +08:00
`app/static/wordfreqapp.db` .
2021-10-17 15:02:54 +08:00
### Adding new articles
2021-07-17 09:47:17 +08:00
To add articles, open and edit `app/static/wordfreqapp.db` using DB Browser for SQLite (https://sqlitebrowser.org).
2021-10-17 15:02:54 +08:00
### Exporting the database
2021-10-17 14:54:48 +08:00
2021-07-16 20:49:57 +08:00
Export wordfreqapp.db to wordfreqapp.sql using the following commands:
- sqlite3 wordfreqapp.db
- .output wordfreqapp.sql
- .dump
- .exit
Put wordfreqapp.sql (not wordfreqapp.db) under version control.
2021-10-17 15:02:54 +08:00
### Creating SQLite file from wordfreqapp.sql
2021-07-17 09:47:17 +08:00
2021-07-16 20:49:57 +08:00
Create wordfreqapp.db using this command: `cat wordfreqapp.sql |
2021-07-17 09:47:17 +08:00
sqlite3 wordfreqapp.db`. Delete wordfreqapp.db first if it exists.
2021-07-16 20:49:57 +08:00
2021-10-17 15:02:54 +08:00
### Uploading wordfreqapp.db to the server
2021-07-16 20:09:51 +08:00
2021-10-17 14:54:48 +08:00
`pscp wordfreqapp.db lanhui@118.*.*.118:/home/lanhui/englishpal/app/static`
2021-07-16 20:09:51 +08:00
2021-10-17 15:02:54 +08:00
## Feedback
2021-07-16 20:09:51 +08:00
2021-10-17 15:02:54 +08:00
We welcome feedback on EnglishPal.
### Respondent 1
2021-07-16 20:31:34 +08:00
2021-07-16 20:34:39 +08:00
2021-10-17 14:54:48 +08:00
"Need a phone app. I use phone a lot. You cannot ask students to use computers."
2021-07-16 20:19:42 +08:00
Can take a picture for text. Automatic translation.
2021-07-16 20:09:51 +08:00
2021-10-17 15:02:54 +08:00
### Respondent 2
2021-07-16 20:09:51 +08:00
“成为会员”改成“注册”
“登出”改成“退出”
“收集生词吧”改成“生词收集栏”
2021-10-17 14:54:48 +08:00
“不要自动显示下一篇”
2021-07-16 20:09:51 +08:00
需要有“上一篇”、“下一篇”
2021-07-16 20:34:39 +08:00
2021-07-16 20:31:34 +08:00
2021-10-17 15:02:54 +08:00
## Bug tracking
2021-10-17 14:54:48 +08:00
EnglishPal's bugs and improvement suggestions are recorded in [Bugzilla ](http://118.25.96.118/bugzilla/buglist.cgi?bug_status=__all__&list_id=1302&order=Importance&product=EnglishPal&query_format=specific ). Send (lanhui at zjnu.edu.cn) an email message for opening a Bugzilla account or reporting a bug.
2021-10-17 15:02:54 +08:00
## TODO
2021-10-17 14:54:48 +08:00
- Fix Bug: Internal server error when register using an email address.
2021-07-16 20:31:34 +08:00
2021-10-17 14:54:48 +08:00
- Usability testing
2021-07-16 20:09:51 +08:00
2021-10-17 15:02:54 +08:00
## Improvements made by contributors
### 朱文绮
2021-07-16 20:09:51 +08:00
2021-06-02 22:10:53 +08:00
在生词簿每个单词后面,加上两个按钮,熟悉与不熟悉:
2021-07-16 20:09:51 +08:00
2021-10-17 14:54:48 +08:00
- 如果点熟悉, 就将生词簿中该单词后面记录的添加次数减一, 直至减为0, 就将该单词从生词簿中移除。
2021-07-16 20:09:51 +08:00
2021-10-17 14:54:48 +08:00
- 如果点不熟悉,就将生词簿中该单词后面记录的添加次数加一。
2021-06-08 20:47:35 +08:00
2021-10-17 15:02:54 +08:00
### 李康恬
2021-07-16 20:09:51 +08:00
Add the function of "Delete already known and well-known words from
the words' library", on the one hand, it can conform to the usage
habits of some users, who do not like that their words' libraries have
too many words that they already know, on the other hand, it can
reduce unnecessary memory occupied by the database, in addition, it
can also improve the simplicity of the page.
2021-06-08 20:47:35 +08:00
2021-07-16 20:09:51 +08:00
More information at: http://118.25.96.118/kanboard/?controller=TaskViewController& action=readonly& task_id=736& token=81a561da57ff7a172da17a480f0d421ff3bc69efbd29437daef90b1b8959
2021-10-17 15:02:54 +08:00
### 占健豪
2021-07-13 11:48:40 +08:00
Click the Familiar or Unfamiliar button (current word frequency>1), the current word position is displayed at the top of the page;
Click the Familiar or Unfamiliar button (current word frequency is 1), and the page will be displayed as the top of the entire page.
Demo video link: https://b23.tv/QuB77m
2021-10-17 15:02:54 +08:00
### 张小飞
2021-07-16 20:09:51 +08:00
修复了以下漏洞。
2021-10-17 14:54:48 +08:00
漏洞:用 `‘ or ‘ 1’ =‘ 1’ ` 这段字符可以作为任何账号的密码登录。
2021-07-16 20:09:51 +08:00
Bug report: http://118.25.96.118/bugzilla/show_bug.cgi?id=215
2021-10-17 14:54:48 +08:00
*Last modified on 2021-10-17*