pythonfreecourse / lms Goto Github PK
View Code? Open in Web Editor NEWLMS allows teachers and educators to easily provide feedback on student programming work - both manually and automatically.
License: BSD 3-Clause "New" or "Revised" License
LMS allows teachers and educators to easily provide feedback on student programming work - both manually and automatically.
License: BSD 3-Clause "New" or "Revised" License
The user should be able to create a shareable link.
view
page). You can use URI fragment identifier as the key. All the logged-in users should be able to watch the exercise in this case.view
page.The grader should be able to mark an exercise.
Maybe it should be kind of labeling system (with multiple choice).
Create a new notification for the student when the mentor has clicked the "I'm done checking" button.
Use sessionStorage to save last state.
Will probably greatly speed loading times and allow us to update the page even without refreshes.
Currently, we share the most popular sidenav comments.
After using the system for a while, I think the best behavior should be:
Show the user which exercises uploaded successfully.
Extra points:
Following the Full Setup instructions from the repo's main README, and after running:
echo "SECRET_KEY = \"$(python -c 'import os;print(os.urandom(32).hex())')\"" >> lms/lmsweb/config.py
I'm getting:
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'str' object has no attribute 'hex'
Not a Pythonista, please excuse if this is kid-level stuff, I'm just debugging by writing this down.
I'm told Python versions matter, and so I'm running (on an AWS EC2 instance):
Python 2.7.17 [GCC 7.5.0] on linux2
Which implies CPython, I suppose (but that's just me twiddling my thumbs in the air now).
Anywho, looking at the docs for os.urandom(32)
for Python 2.7.18 here implies that i should be getting 32 bytes of random data when running that function, and indeed I do when I try to do that in the REPL:
>>> os.urandom(32)
'\x9e\xf70FV\xd3m=4!2\xad\x7f\xcaD-\\\xf5"7\xb6\x9cp8\x88\xf0\x9dx\xf6\xa1\xd0\xd6'
However, chaining hex()
to the function makes Python not happy:
>>> os.urandom(32).hex()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'hex'
I assume the reason why we're using os.urandom()
instead of using uuid.uuid4()
or one of the other uuid
variants has to do with providing a secret key that is cryptographically secure?
Didn't open a PR yet since I wasn't sure whether that's needed, and also I could be missing something basic.
@gal432 I think that's your area, correct?
BTW - actual SECRET_KEY
line with uuid
instead of urandom
:
echo "SECRET_KEY = \"$(python -c 'import uuid;print(uuid.uuid4().hex)')\"" >> lms/lmsweb/config.py
See also: Flask documentation about Sentry.
The button should clear all the displayed notifications.
Adding a suggestion that was posted on the forum.
Change the reviewer notes red color to red and green. The red one will be for "error"/"fix it" notes, and a green one for good notes. With the drop-down list of preset notes, these can already be predefined as red or green.
Check de-duplications only with the latest uploaded version.
It should allow user to view solutions (but not check them)
Create a badge near the notifications button in the navbar that indicates how many notifications the user have.
Current features that I can think of:
Create a way in the GUI to upload notebook for any exercise.
To prevent race-conditions between mentors, we should assign the exercise to a mentor once he sees it.
Possible caveats:
Move all the configuration-related stuff to the same place (app configuration, db configuration etc).
I think lms/lms/config would be perfect for this matter.
It would be much easier to import lms.config.log and to reconfigure the logger in one place for the whole project.
Debugging, as well know, is always a journey. You know where you start, you never know where you'll end...
After hitting a minor setback with #148, I now have the lms.yaml
file up and running with docker-compose
, and a lovely forest of containers is now (noisily) crowding my machine's memory.
Aha! But no cigar for you, ol' tommy - getting a 500 when attempting to access the server's domain.
Looking closely at the running containers:
ubuntu@MY_COOL_SERVER:~/lms$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b1945b60c546 lms:latest "gunicorn --bind 0.0…" About a minute ago Up About a minute 0.0.0.0:8080->8080/tcp lms_http_1
725362d2ce44 lms:latest "celery -A lms.lmste…" About a minute ago Up About a minute lms_checks-public_1
4d7dfc24ba99 lms:latest "celery -A lms.lmste…" About a minute ago Up About a minute lms_checks-sandbox_1
252dd86e4988 docker:dind "dockerd-entrypoint.…" About a minute ago Up About a minute 2375-2376/tcp lms_checks-docker-engine_1
30b9e7ade595 rabbitmq:3.7-management-alpine "docker-entrypoint.s…" About a minute ago Up About a minute 4369/tcp, 5671-5672/tcp, 15671-15672/tcp, 25672/tcp lms_rabbitmq_1
e0acd19e66b6 postgres:11-alpine "docker-entrypoint.s…" About a minute ago Up About a minute (healthy) 0.0.0.0:5432->5432/tcp lms_db_1
Reveals that gunicorn
that is bound to 8080 is the probable culprit (there's an nginx configuration block that points all incoming traffic to /
to proxy_pass 127.0.01:8080
).
Going all docker logs b1945b60c546
reveals the following:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/app_dir/lms/lmsweb/views.py", line 105, in login
user = User.get_or_none(username=username)
File "/usr/local/lib/python3.8/site-packages/peewee.py", line 6389, in get_or_none
return cls.get(*query, **filters)
File "/usr/local/lib/python3.8/site-packages/peewee.py", line 6384, in get
return sq.get()
File "/usr/local/lib/python3.8/site-packages/peewee.py", line 6807, in get
return clone.execute(database)[0]
File "/usr/local/lib/python3.8/site-packages/peewee.py", line 1886, in inner
return method(self, database, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/peewee.py", line 1957, in execute
return self._execute(database)
File "/usr/local/lib/python3.8/site-packages/peewee.py", line 2129, in _execute
cursor = database.execute(self)
File "/usr/local/lib/python3.8/site-packages/peewee.py", line 3112, in execute
return self.execute_sql(sql, params, commit=commit)
File "/usr/local/lib/python3.8/site-packages/peewee.py", line 3106, in execute_sql
self.commit()
File "/usr/local/lib/python3.8/site-packages/peewee.py", line 2873, in __exit__
reraise(new_type, new_type(exc_value, *exc_args), traceback)
File "/usr/local/lib/python3.8/site-packages/peewee.py", line 183, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.8/site-packages/peewee.py", line 3099, in execute_sql
cursor.execute(sql, params or ())
peewee.ProgrammingError: relation "user" does not exist
LINE 1: ..."."password", "t1"."role_id", "t1"."api_key" FROM "user" AS ...
Which screams database error for multiple reason (psycopg2
is a db adapter, and - well - relation does not exist), so I scroll a bit up to the installation script and what do you know, I missed an error message:
WARNING: The DB_NAME variable is not set. Defaulting to a blank string.
Scrolling a couple lines up reveals that it's coming from the ./devops/start.sh
script, which looks like this:
#!/bin/bash
if [ -f secrets.env ]; then
echo "Using prod secrets"
source secrets.env
else
echo "Using default dev variables"
fi
SCRIPT_FILE_PATH=$(readlink -f "${0}")
SCRIPT_FOLDER=$(dirname "${SCRIPT_FILE_PATH}")
docker network create lms
docker-compose -p lms -f "${SCRIPT_FOLDER}/lms.yaml" down
docker-compose -p lms -f "${SCRIPT_FOLDER}/lms.yaml" up -d
Ah, but of course, the error message above is actually a Docker error and not a script error, which means the manifest file needs that variable but it's nowhere to be found. Let's look at lms.yaml
for a sec, just the first few lines:
version: "3"
services:
db:
image: postgres:11-alpine
ports:
- 5432:5432
volumes:
- db-data-volume:/pg_data
environment:
- PGDATA=/pg_data
- POSTGRES_DB=${DB_NAME:-db}
- POSTGRES_USER=${DB_USERNAME:-postgres}
- POSTGRES_PASSWORD=${DB_PASSWORD:-postgres}
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-U", "$DB_NAME"]
...
...
...
So it looks like the default fallback value for DB_NAME
is db
, but here I discovered something that I did not notice before - the container contains stub data!
And if you follow the instructions on the README to completion and run:
docker exec -it lms_http_1 bash
python lmsdb/bootstrap.py
Then you will get access to the holy kingdom:
Gonna close it right after I open it so people can look it up if they get stuck. Debugging for the masses! :)
When resizing the window to about half size, all 4 buttons (log out, archives, upload and notifications) disappear.
This is an actual issue, as I tend to use side-by-side windows so this prevents me from accessing needed buttons.
Expected: still show or converted to a drop down button, but still accessible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.