This code is used for www.pepysdiary.com. This repository includes fixtures for all of the site's data (apart from user accounts and user-contributed comments) although it's often out of date compared to what's live.
Uses Python 2.7.x and Django 1.9.x.
We're using this Ansible playbook.
Add the site as a new app as per the playbook's instructions. Set up the app's variables, download and import the database, manually copy any existing Django media files to the new server.
The environment variables the site uses:
``` AKISMET_API_KEY ALLOWED_HOSTS DB_NAME DB_USERNAME DB_HOST DB_PASSWORD DJANGO_SETTINGS_MODULE MAPBOX_ACCESS_TOKEN MAPBOX_ACCESS_ID RECAPTCHA_PRIVATE_KEY RECAPTCHA_PUBLIC_KEY SENDGRID_USERNAME SENDGRID_PASSWORD ```
Development (might be out of date)
* `cd django-pepysdiary` * Install the Ruby SASS gem (`bundle install --path vendor/bundle`) * Install Node.js and NPM. * Install Gulp (`npm install`). * Watch for changes to SCSS and JS files with `npm run watch`.
### SASS and CSS
This uses SASS, generating CSS files from the SCSS in
pepysdiary/common/static/sass/. Compass is Ruby. Settings for this are in
To ensure SASS (Ruby) is installed, rom the top-level directory of this project, run:
$ bundle install --path vendor/bundle
to install the gem specified in
Gemfile (SASS) and install it locally.
To update all the gems to the latest versions:
$ bundle update
We use Gulp to:
$ npm install
Then run this to watch for any changes to the SCSS or JS files:
$ npm run watch
Or, for a one-off run:
$ npm run gulp
As mentioned above, we're using Boostrap SASS to generate a custom set of Bootstrap CSS. Comment/uncomment lines in
pepysdiary/common/static/sass/_bootstrap_custom.scss to change which parts of Bootstrap's CSS are included in the generated CSS file.
Instead of steps 2 and 3 you can hopefully upload the
Toggle off all of the checkboxes.
Under the "jQuery plugins" section check the boxes next to these plugins:
- Linked to components
- Alert dismissal
- Togglable tabs
- Linked to components
Scroll to the bottom of the page and click the "Compile and Download" button.
Copy the two .js files into
pepysdiary/common/static/js/libs/, replacing the existing files.
## Wikipedia content
To fetch content for all Encyclopedia Topics which have matching Wikipedia pages, run:
$ ./manage.py fetch_wikipedia --all --verbosity=2
It might take some time. See
encyclopedia/management/commands/fetch_wikipedia.py for more options.
Lots of site-wide stuff is in the
pepysdiary/common/ app. Including the CSS, JS and images in
Setting up with Ansible
Using https://github.com/philgyford/ansible-playbook on DigitalOcean.
Follow the DigitalOcean instructions in that README.
Maybe: Follow the "Django database" section, to destro empty database and import from a backup.
Maybe: Upload Media files.