An internal tool designed for Code.org curricula
- Go to the #curriculumbuilder-dev channel for support
- install mac os x dependencies
brew install openssl postgres heroku/brew/heroku Caskroom/cask/wkhtmltopdf
brew services start postgresql
- make sure you have python 2.7
python -V # -> Python 2.7.10
if you don't, try installing it:
brew install python@2
And then run python -V
again to make sure you now have version 2.7 installed. If you don't, stop here and try to get yourself onto this version of python before proceeding.
- clone repo
git clone https://github.com/mrjoshida/curriculumbuilder.git
cd curriculumbuilder
- set up virtualenv (https://docs.python-guide.org/dev/virtualenvs/#lower-level-virtualenv)
pip install virtualenv
mkdir ~/.virtualenvs
virtualenv ~/.virtualenvs/cb
source ~/.virtualenvs/cb/bin/activate
- install python dependencies
pip install -r requirements.txt
if you are returning to this step to fix problems with pycurl, you may need to also add the --no-cache-dir
flag.
- copy the db
heroku login # need credentials from Josh C.
heroku pg:pull DATABASE_URL curriculumbuilder -a curriculumbuilder
- set up local_settings.py
cp curriculumBuilder/local_settings.py.example curriculumBuilder/local_settings.py
- run the tests
npm install
./manage.py test
- run the server
source ~/.virtualenvs/cb/bin/activate # must be run once per shell window
debug=true python manage.py runserver_plus
-
troubleshooting pycurl
There are two potential errors you can get which look very similar:
-
ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)
solution: https://cscheng.info/2018/01/26/installing-pycurl-on-macos-high-sierra.html
-
ImportError: pycurl: libcurl link-time ssl backend (none/other) is different from compile-time ssl backend (openssl)
solution: https://gist.github.com/webinista/b4b6a4cf8f158431b2c5134630c2cbfe#gistcomment-3057612
- measure test coverage
pip install -r requirements-dev.txt
DJANGO_SETTINGS_MODULE=curriculumBuilder.settings debug=true coverage run ./manage.py test
coverage report
If you run this often, it may be worth appending the --keepdb
flag to make it run faster,
and temporarily disabling any tests which fail as a result.
These instructions are a work in progress.
- install dependencies
sudo apt-get install python-pip postgresql wkhtmltopdf
# some of these may be unneccessary
sudo apt-get install libcurl4-openssl-dev libssl-dev postgresql-contrib
sudo snap install --classic heroku
- configure postgresql
sudo service postgresql start
sudo -u postgres psql
CREATE USER ubuntu;
ALTER USER ubuntu SUPERUSER CREATEDB;
at this point I got stuck:
(cb) ip-10-0-0-19:~/cb (master)$ heroku pg:pull DATABASE_URL curriculumbuilder -a curriculumbuilder
pg_dump: server version: 9.6.15; pg_dump version: 9.5.19
pg_dump: aborting because of server version mismatch
# dropdb curriculumbuilder # to backtrack and try again
CurriculumBuilder is actually two separate websites:
- codecurricula.com - where curriculum writers edit the curriculum
- curriculum.code.org - where teachers access the curriculum
When you add a feature to CurriculumBuilder by merging a commit your change will automatically be deployed to codecurricula.com. You can watch the #curriculumbuilder channel to see when it gets deployed.
In order for your change to show up on curriculum.code.org all of the impacted curriculum must be republished. Developers should ask the curriculum team to republish their curriculum so that we don't accidentally ship a change to the curriculum that was not ready to go out.
To update your local database schema use the following command:
./manage.py migrate
dropdb curriculumbuilder
heroku pg:pull DATABASE_URL curriculumbuilder -a curriculumbuilder
If you have an account and are a superuser, you can create new CurriculumBuilder users by doing the following:
- Log in at codecurricula.com/admin. Choose the "admin" interface.
- Choose the "Users" option in the left-hand navigation menu, or go to codecurricula.com/admin/auth/user/. Here, you can view, update, and create users.
- Use the "Add user" button to create a new user.
- Set the user's permissions:
- All users need to have
www.codecurricula.com
added to their site permissions. - All staff members will need "staff status" set to true.
- Curriculum writers need to be added to the "author" group.
- If you need this new user for local development purposes, update your local database contents.