Source code to
JavaScript Python HTML CSS CoffeeScript Ruby Other
Latest commit 5eb752e Oct 22, 2016 @timgraham timgraham Updated to raven==5.31.0
Failed to load latest commit information.
accounts Fixed #697 -- Added missing chars to URLConf for profile view. Aug 25, 2016
aggregator [BUGFIX] When people.djangoproject is down/slow first non cache page … Jul 2, 2016
blog Removed flake8 exclude from migrations. Feb 10, 2016
contact Added email validation to contact form. Jan 5, 2016
dashboard Added fixtures of dashboard's categories and metrics. Oct 3, 2016
djangoproject Fixed #704 -- Changed fundraising page hero logos to 3 rather than 4 … Oct 3, 2016
docs Fixed #627 -- Disabled builds of non-stable translated docs. Jul 29, 2016
fundraising Fixed #551 -- Prevented a hero from being created on a failed donation. Oct 3, 2016
legacy Fixed test error views. Feb 23, 2016
members Activated DeveloperMemberListView to replace flatpage. Jul 8, 2016
releases Added 1.9 and 1.10 Releases to fixture. Aug 30, 2016
requirements Updated to raven==5.31.0 Oct 22, 2016
svntogit Removed usage of deprecated assertEquals(). Jan 21, 2016
tracdb Added on_delete to ForeignKey and OneToOneField. Jan 21, 2016
.bowerrc Added bower config and use local webfont loader. Jan 2, 2015
.coveragerc Fixed tests and added CI. Jan 22, 2015
.editorconfig Add EditorConfig file Dec 24, 2014
.gitignore Improved Bower integration. Dec 17, 2015
.travis.yml Add isort settings and sort imports Apr 7, 2015
LICENSE Fixed #477 -- Added LICENSE. Jun 12, 2015
Makefile Removed cla app in a few more places. Jan 21, 2016
Procfile Big refactor that combines www and docs. Dec 30, 2014
README.rst Added fixtures of dashboard's categories and metrics. Oct 3, 2016
bower.json Fixed #181 -- Added copy-to-clipboard feature to code snippets Jul 6, 2016 Big refactor that combines www and docs. Dec 30, 2014
package.json Improved Bower integration. Dec 17, 2015
setup.cfg Added .tox to flake8 ignore. Jul 25, 2016
tox.ini Add isort settings and sort imports Apr 7, 2015

README.rst source code

To run locally, do the usual:

  1. Create a Python 3.4 virtualenv

  2. Install dependencies:

    pip install -r requirements/dev.txt
    npm install

    Alternatively use the make task:

    make install
  3. Make a directory to store the project's data (MEDIA_ROOT, DOC_BUILDS_ROOT, etc.). We'll use ~/.djangoproject for example purposes.

    Create a 'secrets.json' file in a directory named 'conf' in that directory, containing something like:

    { "secret_key": "xyz",
      "superfeedr_creds": ["", "some_string"],
      "db_host": "localhost",
      "db_password": "secret",
      "trac_db_host": "localhost",
      "trac_db_password": "secret" }

    Add export DJANGOPROJECT_DATA_DIR=~/.djangoproject (without the backticks) to your ~/.bashrc (or ~/.zshrc if you're using zsh) file and then run source ~/.bashrc (or source ~/.zshrc) to load the changes.

  4. Create databases:

    createuser -d djangoproject
    createdb -O djangoproject djangoproject
    createuser -d code.djangoproject
    createdb -O code.djangoproject code.djangoproject
  5. Setting up database access

    If you are using the default postgres configuration, chances are you will have to give a password for the newly created users in order to be able to use them for Django:

    ALTER USER djangoproject WITH PASSWORD 'secret';
    ALTER USER "code.djangoproject" WITH PASSWORD 'secret';

    (Use the same passwords as the ones you've used in your secrets.json file)

  6. Create tables:

    psql -d code.djangoproject < tracdb/trac.sql
    ./ migrate
  7. Create a superuser:

    ./ createsuperuser
  8. Populate the www and docs hostnames in the django.contrib.sites app:

    ./ loaddata dev_sites
  9. For docs:

    ./ loaddata doc_releases
    ./ update_docs
  10. For dashboard:

    To load the latest dashboard categories and metrics:

    ./ loaddata dashboard_production_metrics

    Alternatively, to load a full set of sample data (takes a few minutes):

    ./ loaddata dashboard_example_data

    Finally, make sure the loaded metrics have at least one data point (this makes API calls to the URLs from the metrics objects loaded above and may take some time depending on the metrics chosen):

    ./ update_metrics
  11. Point the, and hostnames with your /etc/hosts file to localhost/ Here's how it could look like:

    If you're on Mac OS and don't feel like editing the /etc/hosts file manually, there is a great preference pane called Hosts.prefpane. On Ubuntu there is a built-in network admin GUI to do the same. Remember both require admin privileges, just like you'd need when editing /etc/hosts with your favorite editor.

    If you don't have admin rights but have an internet connection, you can use a service like In that case you'll also have to update ALLOWED_HOSTS in djangoproject/settings/ as well as the content of the django_site table in your database.

  12. Compile the CSS (only the source SCSS files are stored in the repostiory):

    make compile-scss
  13. Finally run the server:

    make run

    This runs both the main site ("www") as well as the docs and dashboard site in the same process. Open, or

Running the tests

We use Travis-CI for continuous testing and GitHub pull request integration. If you're familiar with those systems you should not have any problems writing tests.

Our test results can be found here:

For local development don't hesitate to install tox to run the website's test suite.

Then in the root directory (next to the file) run:


Behind the scenes this will run the usual ./ test management command with a preset list of apps that we want to test as well as flake8 for code quality checks. We collect test coverage data as part of that tox run, to show the result simply run:

coverage report

or for a HTML-based report:

coverage html

(Optional) In case you're using an own virtualenv you can also run the tests manually using the test task of the Makefile. Don't forget to install the test requirements with the following command first though:

pip install -r requirements/tests.txt

Then run:

make test

or simply the usual test management command:

./ test [list of app labels]

Supported browsers

The goal of the site is to target various levels of browsers, depending on their ability to use the technologies in use on the site, such as HTML5, CSS3, SVG, webfonts.

We're following Mozilla's example when it comes to categorize browser support.

  • Any browser other than IE8 and lower as A grade. Which means everything needs to work on those.
  • IE8 is B grade, meaning that some functionality may be disabled, visual variations are acceptable but the content must work nevertheless.
  • IE below 8 is not supported.
  • Mobile browsers should be considered B grade as well. Mobile Safari, Firefox on Android and the Android Browser should support the responsive styles as much as possible but some degredation can't be prevented due to the limited screen size and other platform restrictions.

File locations

Static files such as CSS, JavaScript or image files can be found in the djangoproject/static subdirectory.

Templates can be found in the djangoproject/templates subdirectory.


CSS is written in Scss and compiled via Libsass.

Run the following to compile the Scss files to CSS:

make compile-scss-debug

Alternatively you can also run the following command in a separate shell to continuously watch for changes to the Scss files and automatically compile to CSS:

make watch-scss

Running all at once

Optionally you can use a tool like Foreman to run all process at once:

This is great during development. Assuming you're using Foreman simply run:

foreman start

If you just want to run one of the processes defined above use the run subcommand like so:

foreman run web

That'll just run the www server.

Check out the Procfile file for all the process names.

JavaScript libraries

This project uses Bower to manage JavaScript libraries.

At any time, you can run it to install a new library (e.g., jquery-ui):

npm run bower install jquery-ui --save

or check if there are newer versions of the libraries that we use:

npm run bower ls

If you need to update an existing library, the easiest way is to change the version requirement in bower.json and then to run npm run bower install again.

We commit the libraries to the repository, so if you add, update, or remove a library from bower.json, you will need to commit the changes in djangoproject/static too.

Documentation search

In case you want to use the documentation search you have to install Elasticsearch locally and start it on port 9200 (the default). See the official Elasticsearch docs for how to set it up.

When running ./ update_docs to build all documents it will also automatically index every document it builds in the search engine as well. In case you've already built the documents and would like to reindex the search index run the command:

./ update_index

This is also the right command to run when you work on the search feature itself. You can pass the -d option to try to drop the search index first before indexing all the documents.

Updating metrics from production

The business logic for dashboard metrics is edited via the admin interface and contained in the models in the dashboard app (other than Dataum, which contains the data itself). From time to time, those metrics should be extracted from a copy of the production database and saved to the dashboard/fixtures/dashboard_production_metrics.json file.

To update this file, run:

./ dumpdata dashboard --exclude dashboard.Datum --indent=4 > dashboard_production_metrics.json