courselets.org web service implementation
Switch branches/tags
add_search#dmitry alexb/lms_page chat_ud#rebased chat_ui#frontend chat_ui#rebased chat_ui checking_SMTP#batozskiy course_creation course_report_api#dmitry#tests course_report_api create_course_rebased create_course ct_tests_rebased#derdmitry ct_tests_rebased ct_tests deployment_update develop development docker_rebased docker fab-deploy-improve#batozskiy fab-deploy-improve fab-deploy#batozskiy fab-deploy#derdmitry#nginx fab-deploy fabric_deploy feat/ci feature/author_name_old feature/author_name feature/chat_add_unit feature/cms feature/fix/issue#203 feature/fix/issue#237 feature/fix/issue#238 feature/instructor-authoring feature/invite_fixes feature/invites_merged feature/invites feature/issue#288 feature/issue#289 feature/issue#293 feature/issue#294 feature/issue#295 feature/issue#343 feature/issue#344 feature/issue#364 feature/issue#501 feature/karl-courselet-history feature/live_add_chat_breakpoints_add_lessons_to_leftBar feature/live_add_msgs_on_wait_nodes feature/live_add_status_prevNode feature/live_alex_tmp feature/live_alexb_tasks feature/live_alexb feature/live_cms feature/live_end_msg feature/live_fix_loop_questions feature/live_hide_resources_header_if_live feature/live_not_show_resources_if_live feature/live_session_correct_progress feature/live_session_fsm feature/live_stable feature/live_templates_fix feature/live_tmp_fix feature/live_tmpl_fixes feature/live_waffle feature/live feature/middleware_memory feature/multiple_choices feature/mvp_instructor feature/new_interaction feature/next_page_mw file_based_backend fix/add_need_help_responses_to_course_page fix/add_to_admin_Linked_model fix/admin_Liked_model fix/chat_history_page fix/chat_refactor fix/check_quality.sh fix/cms_landing_fixes fix/cms_merge_issues fix/cms_page_landing fix/confidence_selfeval fix/copy_course_fix fix/copy_course_triple fix/courselet_history fix/history_live_session fix/init_chat_js fix/instructor-onboarding fix/instructor_icon fix_issue#70 fix_issue#71 fix_issue#74#tests fix_issue#74 fix_issue#89 fix_issue#93#UIXchange fix_issue#93_rebased fix_issue#93#tests fix_issue#93 fix_issue#109 fix_issue#134 fix_issue#136 fix_issue#137 fix_issue#138 fix_issue#139 fix_issue#140 fix_issue#141 fix_issue#144 fix_issue#145 fix_issue#146 fix_issue#148 fix_issue#149 fix_issue#150 fix_issue#151 fix_issue#152 fix_issue#153 fix_issue#154 fix_issue#155 fix_issue#157 fix/issue#195 fix/issue199 fix/issue#216 fix/issue#218 fix/issue#226 fix/issue#234 fix/issue#254 fix/issue#255_master fix/issue#255 fix/issue#256 fix/issue#261 fix/issue#268 fix/issue#290 fix/issue#324 fix/issue342 fix/issue#345 fix/issue#353 fix/issue#354 fix/issue#377 fix/issue#386 fix/issue#412 fix/issue#421 fix/issue#428 fix/issue#434 fix/issue#455_latest fix/issue#455 fix/issue#463 fix/issue#471 fix/issue#484 fix/issue#512 fix/issue#532 fix/issue#533 fix/issue#539 fix/issue#549 fix/issue#572 fix/issue#573 fix/issue#575 fix/issue#585 fix/issue#595 fix/old_chat_confidence fix/redo_courslet_tests fix/remove_history_tab fix/sidebar_click fix/sidebar_mware fix/stop_create_errors_for_new_ORCT fix/test_fixtures fsm_db_index fsm_deploy_manage_cmd fsm_optimization fsm_refactor getsentry#derdmitry gh-pages google_analytics gulp#derdmitry gulp_fix hack_ui#batozskiy hack_ui#concepts hack_ui#elastic hack_ui#issue_proto hack_ui#labels hack_ui#lesson_api hack_ui#module_views hack_ui#rbuild#dmitry hack_ui#retrive_course_info hack_ui#sidebar#derdmitry hack_ui#test_and_doc hack_ui hackaton_landing integrate_cms issue#19#derdmitry_rebased issue#19#derdmitry issue#73#batozskiy issue#97#test issue#97 issue#120#test issue#120 ja landing_active-learning#maxsocl landing_benefits_plugin#derdmitry landing_faq_plugin#derdmitry landing_footer_plugin#batozskiy landing_header_banner#derdmitry landing_interested_plugin#derdmitry landing_list_plugin#maxsocl landing_social_plugin#batozskiy landing_sponsored#maxsocl lti_management lti_release master md2html_db_implementation merge/instructor-master origin/ct_tests_rebased psa_refactor psa_version_update pytest_enh release smtp_errors_handling_rebased smtp_errors_handling test_github_integration travis-ci update_documentation
Nothing to show
Clone or download
Pull request Compare This branch is even with cjlee112:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.conf
.github
config
doc
envs
fabfile
logs
mysite
requirements
site-text
.coveralls.yml
.dockerignore
.flake8
.gitignore
.gitlab-ci.yml
Dockerfile
Dockerfile.CI
Dockerfile.celery
Dockerfile.node
Dockerfile.prod
LICENSE
Makefile
README.rst
buildspec.yml
check-quality.sh
dev.yml
prod.yml
requirements.txt

README.rst

Socraticqs2

https://coveralls.io/repos/github/cjlee112/socraticqs2/badge.svg?branch=master https://circleci.com/gh/raccoongang/socraticqs2/tree/development.svg?style=svg

Socraticqs2 is the web engine for courselets.org.

Local development environment

To run project locally

make run

To develop/debug project locally

make debug

To build project locally

make build

To run tests:

make test

To stop containers:

make stop

To clean/rm containers:

make rm

To run production/staging environment locally:

make run env=stage

To build production/staging environment locally:

make build env=stage

CI/CD

CI/CD configuration is described by .gitlab-ci.yml file.

Current deployment scheme is the following:

  • any commit pushed in development branch is deployed on dev environment
  • any commit pushed in master branch is deployed on stage environment
  • to publish version on production you need to create an annotated tag in format of "vX.X.X" (where X.X.X is version number) and push it to repository.

There is a helper that creates a tag for you:

make version VERSION=vX.X.X


Onboarding settings

Switches

ctms_onboarding_enabled set to Active in admin page /admin/waffle/switch/

Developer documentation is available at http://cjlee112.github.io/socraticqs2

For a developer / test version to access social-auth, you will need to add the following social-auth keys to settings/local_conf.py in your development install:

# coding: utf-8

SOCIAL_AUTH_TWITTER_KEY = 'key'
SOCIAL_AUTH_TWITTER_SECRET = 'secret'

SOCIAL_AUTH_FACEBOOK_KEY = 'key'
SOCIAL_AUTH_FACEBOOK_SECRET = 'secret'

SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY = 'key'
SOCIAL_AUTH_LINKEDIN_OAUTH2_SECRET = 'secret'

SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = 'key'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'secret'

SOCIAL_AUTH_KHANACADEMY_OAUTH1_KEY = 'key'
SOCIAL_AUTH_KHANACADEMY_OAUTH1_SECRET = 'secret'

# When we will use email auth we need to define SMTP settings
EMAIL_USE_TLS = True
EMAIL_HOST = ''
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_PORT = 587
EMAIL_FROM = ''

#We can re-define auth backend(s)
AUTHENTICATION_BACKENDS = (
   # 'social.backends.twitter.TwitterOAuth',
   # 'social.backends.facebook.FacebookOAuth2',
   # 'social.backends.google.GoogleOAuth2',
   # 'social.backends.linkedin.LinkedinOAuth2',
   # 'social.backends.khanacademy.KhanAcademyOAuth1',
   # 'psa.custom_backends.EmailAuth',
   'django.contrib.auth.backends.ModelBackend',
)

To install requirements:

pip install -r requirements/dev.txt

Download GeoIp database (run commands in the root of the project):

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz

To run project in Docker:

Go to the root of the project and run this command:

docker-compose up courselets
Here we have 2 docker config files:
  • Dockerfile - runs docker-commands.sh file
  • Dockerfile-prepare - installs requirements (python libs and so on)
There are a couple of files related to docker. They are:
  • docker-compose.yml - config file
  • docker-commands.sh - clear *.pyc files and starts web server

New Interactions Features:

  • Multiple Choices Feature
  • Equation Feature
  • Numbers Feature
  • Canvas Feature

Multiple Choices Feature:

How to test this functionality: * setup project * load fixtures from dumpdata/debug-wo-fsm.json * load fixtures from dumpdata/ct_mult_choices.json * open admin UI and create roles for your user and course named test MultChoices * observe Courses Dashboard and you will see test MultChoices course with a couple of cocurselets inside of it. * ..... * Profit!

To create unit with multiple choices:
  • create course, courselet in old UI
  • create thread with kind Question (ORCT)
  • input this text in question text area:
[choices]
() a
(*) b
() c
() d
Where: not correct answer is empty parenthes () and correct answer is (*)
  • change field sub_kind to Multiple choices
  • save
  • go to New IU and click Courselet Preview to view changes.

Equation Feature:

To create a thread with numbers answer (and grading):
  • create course, courselet (or use existing one) in old UI
  • create thread with kind Question (ORCT)
  • input this text in Question field for example: .. math:: F=mg

Please note that .. and :: are required .. math:: is a prefix to find formulas. * input some text in Answer field * change field sub_kind to Equation * save * go to new UI and click Preview Courselet

Numbers Feature:

To create a thread with numbers answer (and grading):
  • create course, courselet (or use existing one) in old UI
  • create thread with kind Question (ORCT)
  • input this text in Question field for example: 1+1=?
  • input answer in field Answer
  • change field sub_kind to Numbers, also you can enable autograding with Enable autograding checkbox
  • go to answer and change Number value - it's exact answer for this question
  • change and Number max value and Number min value - this is precision.
  • Please note that Number min value <= Number value <= Number max value
  • save
  • go to new UI and click Preview Courselet

Canvas Feature:

To create a thread with canvas answer:
  • create course, courselet (or use existing one) (in old UI)
  • create thread with kind Question (ORCT)
  • input this text in Question field for example: Paint number 1
  • change field sub_kind to Canvas
  • you also can upload image that will be used as a back ground for space where user will draw image
  • save
  • go to new UI and click Preview Courselet

Quality check

We can check code quality using ./check-quality.sh {pep8|pylint} {lti|psa|fsm|ct|mysite|all} script. We encourage you to run this script before each commit.

Feature Switches

We can switch on and switch off different features. By default all features are switched off. Here's a list of switches:

  • ctms_invite_students - to invite user as a student
  • live_session_enabled - to enable button "Live session"
  • menu_activity_center_link_enabled - to enable activity center link in top menu
  • add_unit_by_chat - to enable add unit by chat feature in CTMS

GitLab configuration

Need to set following secret variables: * DOCKER_IMG_NAME * DOCKER_PASSWORD * DOCKER_USERNAME

Instructor Agreement

When user tries to go to CTMS page, but has no Instructor instance attached, user will not see page but will see the error message. Error 404, because user's who are not instructor has no access to this part of site.

That's why we created new page named Instructor Agreement, which should be added through admin CMS with custom content.

  • Go to /admin/cms/page
  • Create new page named Instructor Agreement (or with any other name, but remember URL to this page)
  • Open mysite/settings/base.py file and check BECOME_INSTRUCTOR_URL.
  • BECOME_INSTRUCTOR_URL must be the same as URL of Instructor Agreement page.
  • Reload server.

SES configuration

fill the following settings in order to have ability to send emails AWS_ACCESS_KEY_ID = '' AWS_SECRET_ACCESS_KEY = '' AWS_SES_REGION_NAME = '' AWS_SES_REGION_ENDPOINT = ''