Commit b4ceb7fc1d20db61394f2a728298c0cfaf37081f
1 parent
39cd1cfe
Exists in
master
and in
1 other branch
minor change in logger.yaml
Showing
5 changed files
with
16 additions
and
11 deletions
Show diff stats
BUGS.md
| 1 | 1 | ||
| 2 | # BUGS | 2 | # BUGS |
| 3 | 3 | ||
| 4 | +- permitir configuracao para escolher entre static files locais ou remotos | ||
| 4 | - sqlalchemy.pool.impl.NullPool: Exception during reset or similar | 5 | - sqlalchemy.pool.impl.NullPool: Exception during reset or similar |
| 5 | sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. | 6 | sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. |
| 6 | 7 |
README.md
| @@ -85,8 +85,9 @@ At this point aprendizations is installed in | @@ -85,8 +85,9 @@ At this point aprendizations is installed in | ||
| 85 | ~/.local/bin # FreeBSD/Linux | 85 | ~/.local/bin # FreeBSD/Linux |
| 86 | ``` | 86 | ``` |
| 87 | 87 | ||
| 88 | -and can be run with the command `aprendizations` (make sure this directory is | ||
| 89 | -in your `$PATH`). | 88 | +Make sure this directory is in your `$PATH`. |
| 89 | + | ||
| 90 | +The server can be run with the command `aprendizations` from the terminal. | ||
| 90 | 91 | ||
| 91 | ## Configuration | 92 | ## Configuration |
| 92 | 93 | ||
| @@ -121,7 +122,7 @@ have a registered publicly accessible domain name. | @@ -121,7 +122,7 @@ have a registered publicly accessible domain name. | ||
| 121 | 122 | ||
| 122 | #### Selfsigned | 123 | #### Selfsigned |
| 123 | 124 | ||
| 124 | -Generate a selfsigned certificate and place it in `aprendizations/certs`. | 125 | +Generate a selfsigned certificate and place it in `~/.local/share/certs`. |
| 125 | 126 | ||
| 126 | ```sh | 127 | ```sh |
| 127 | openssl req -x509 -newkey rsa:4096 -keyout privkey.pem -out cert.pem -days 365 -nodes | 128 | openssl req -x509 -newkey rsa:4096 -keyout privkey.pem -out cert.pem -days 365 -nodes |
| @@ -141,7 +142,7 @@ sudo certbot certonly --standalone -d www.example.com | @@ -141,7 +142,7 @@ sudo certbot certonly --standalone -d www.example.com | ||
| 141 | sudo service pf start # enable pf firewall | 142 | sudo service pf start # enable pf firewall |
| 142 | ``` | 143 | ``` |
| 143 | 144 | ||
| 144 | -Certificates are saved under `/usr/local/etc/letsencrypt/live/www.example.com/`. Copy them to `aprendizations/certs` and change permissions to be readable: | 145 | +Certificates are saved under `/usr/local/etc/letsencrypt/live/www.example.com/`. Copy them to `~/.local/share/certs` and change permissions to be readable: |
| 145 | 146 | ||
| 146 | ```sh | 147 | ```sh |
| 147 | sudo cp /usr/local/etc/letsencrypt/live/www.example.com/cert.pem . | 148 | sudo cp /usr/local/etc/letsencrypt/live/www.example.com/cert.pem . |
| @@ -157,7 +158,7 @@ sudo certbot renew | @@ -157,7 +158,7 @@ sudo certbot renew | ||
| 157 | sudo service pf start # start firewall | 158 | sudo service pf start # start firewall |
| 158 | ``` | 159 | ``` |
| 159 | 160 | ||
| 160 | -and then copy the `cert.pem` and `privkey.pem` files to `aprendizations/certs` directory. Change permissions and ownership as appropriate. | 161 | +and then copy the `cert.pem` and `privkey.pem` files to `~/.local/share/certs` directory. Change permissions and ownership as appropriate. |
| 161 | 162 | ||
| 162 | 163 | ||
| 163 | ### Testing | 164 | ### Testing |
| @@ -169,7 +170,8 @@ cd demo | @@ -169,7 +170,8 @@ cd demo | ||
| 169 | aprendizations demo.yaml | 170 | aprendizations demo.yaml |
| 170 | ``` | 171 | ``` |
| 171 | 172 | ||
| 172 | -and open a browser at [https://127.0.0.1:8443](). If it everything looks good, | 173 | +and open a browser at [https://127.0.0.1:8443](https://127.0.0.1:8443). |
| 174 | +If it everything looks good, | ||
| 173 | check at the correct address `https://www.example.com` (requires port forward | 175 | check at the correct address `https://www.example.com` (requires port forward |
| 174 | in the firewall). The option `--debug` provides more verbose logging and might | 176 | in the firewall). The option `--debug` provides more verbose logging and might |
| 175 | be useful during testing. The option `--check` generates all the questions once | 177 | be useful during testing. The option `--check` generates all the questions once |
aprendizations/learnapp.py
| @@ -459,3 +459,5 @@ class LearnApp(object): | @@ -459,3 +459,5 @@ class LearnApp(object): | ||
| 459 | for uid, name in students if uid != '0'] | 459 | for uid, name in students if uid != '0'] |
| 460 | 460 | ||
| 461 | return sorted(rankings, key=lambda x: x[2], reverse=True) | 461 | return sorted(rankings, key=lambda x: x[2], reverse=True) |
| 462 | + | ||
| 463 | + # ------------------------------------------------------------------------ |
aprendizations/questions.py
| @@ -28,9 +28,9 @@ class QuestionException(Exception): | @@ -28,9 +28,9 @@ class QuestionException(Exception): | ||
| 28 | # =========================================================================== | 28 | # =========================================================================== |
| 29 | class Question(dict): | 29 | class Question(dict): |
| 30 | ''' | 30 | ''' |
| 31 | - Classes derived from this base class are meant to instantiate a question | ||
| 32 | - to a student. | ||
| 33 | - Instances can shuffle options, or automatically generate questions. | 31 | + Classes derived from this base class are meant to instantiate questions |
| 32 | + for each student. | ||
| 33 | + Instances can shuffle options or automatically generate questions. | ||
| 34 | ''' | 34 | ''' |
| 35 | def __init__(self, q: QDict) -> None: | 35 | def __init__(self, q: QDict) -> None: |
| 36 | super().__init__(q) | 36 | super().__init__(q) |
| @@ -125,7 +125,7 @@ class QuestionRadio(Question): | @@ -125,7 +125,7 @@ class QuestionRadio(Question): | ||
| 125 | self['correct'] = [float(correct[i]) for i in perm] | 125 | self['correct'] = [float(correct[i]) for i in perm] |
| 126 | 126 | ||
| 127 | # ------------------------------------------------------------------------ | 127 | # ------------------------------------------------------------------------ |
| 128 | - # can return negative values for wrong answers | 128 | + # can assign negative grades for wrong answers |
| 129 | def correct(self) -> None: | 129 | def correct(self) -> None: |
| 130 | super().correct() | 130 | super().correct() |
| 131 | 131 |
config/logger.yaml
| @@ -5,7 +5,7 @@ formatters: | @@ -5,7 +5,7 @@ formatters: | ||
| 5 | void: | 5 | void: |
| 6 | format: '' | 6 | format: '' |
| 7 | standard: | 7 | standard: |
| 8 | - format: '%(asctime)s | %(thread)-15d | %(levelname)-9s | %(name)-24s | %(message)s' | 8 | + format: '%(asctime)s | %(thread)-15d | %(levelname)-9s | %(message)s' |
| 9 | datefmt: '%Y-%m-%d %H:%M:%S' | 9 | datefmt: '%Y-%m-%d %H:%M:%S' |
| 10 | 10 | ||
| 11 | handlers: | 11 | handlers: |