TO enable xblock rendering on edX platform you need to add below flag inside features list in lms.env.json
"ENABLE_RENDER_XBLOCK_API":true
- Create virtual environment (i.e follow steps in http://docs.python-guide.org/en/latest/dev/virtualenvs/)
- Install requirments.txt
pip install -r requirments.txt
- Install phantom js
npm install
python take_screenshot.py
- Open url http://0.0.0.0:5000/ (In local environment)
- Add xblock url (i.e http://localhost:8000/api/xblock/v0/xblock/i4x://edX/DemoX/html/030e35c4756a4ddc8d40b95fbbfff4d4)
- Add your edX platform credentials
- Click
Get screenshot
and get screenshot at location output/screens/time_mili_sec.png
- Follow below 2 links https://devcenter.heroku.com/articles/getting-started-with-python#deploy-the-app https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app
Note you need 2 buildpacks i.e Nodejs and python
https://github.com/heroku/heroku-buildpack-python.git
https://github.com/heroku/heroku-buildpack-nodejs.git
You can run tests by following command
python -m unittest test_take_screenshot
You can test coverage by following command
coverage run --source take_screenshot.py test_take_screenshot.py
coverage report -m take_screenshot.py