-
Notifications
You must be signed in to change notification settings - Fork 45
Setting up a development environment
Requires Python 3.6. We recommend Anaconda.
- Install npm
-
git clone https://github.com/CJWorkbench/cjworkbench.git
to clone this repo -
pip install pipenv
for pipenv -
pipenv sync --dev
to install Python packages -
npm install
to install JavaScript packages -
bin/dev
to run database migrations, create the superuser (emailadmin@localhost
passwordadmin123
), start compiling JavaScript/CSS files, and run Django - Browse to http://localhost:8000 and log in as
admin@localhost
/admin123
- You will be prompted to confirm your email. In a separate terminal,
cat local_mail/*.log
and visit the confirmation URL therein.
-
bin/dev
to run pending migrations, start compiling JavaScript/CSS files, and run Django - Browse to http://localhost:8000
If you test features that send email (such as confirmation email for new accounts) the email will appear in the local_mail
folder in your cjworkbench
directory.
-
pipenv run ./manage.py test
for backend tests -
npm test
for frontend tests - For integration tests, install Docker and geckodriver and then run
./bin/integration-test
for integration tests.
Geckodriver isn't obvious to install. On a Mac, do
wget https://github.com/mozilla/geckodriver/releases/download/v0.20.1/geckodriver-v0.20.1-macos.tar.gz
tar -xzf geckodriver-v0.20.1-macos.tar.gz
chmod +x geckodriver
sudo mv geckodriver /usr/local/bin
Then run bin/integration-test
This builds (if necessary) and runs a production Docker container and uses it as the server for integration tests. If any of the tests fails, the Docker process keeps running (you can see it with docker ps
) and you can re-run any specific test like this:
pipenv run python -m unittest -v integrationtests.lessons.test_load_public_data
If you want to test logging in with Facebook and Google, you'll need to either manually set up social applications in the Django admin interface, or get or create a file called socialaccounts_secrets.json
in the project root. The file contains a list of objects defining a social account, like so:
{
'name':'Display Name',
'provider':'social_acccount_provider', // a full list is here: https://django-allauth.readthedocs.io/en/latest/providers.html
'client_id':'12345', // Your chosen provider's app id/client id -- everyone calls this something different
'secret':'12345' // Same as above but for client_secret
}
Once you've created this file run pipenv run ./manage.py load_socialaccounts