Skip to content

dailycal-projects/public-trust

 
 

Repository files navigation

public-trust

What is this?

The Public Trust is a Daily Californian audio project exploring what it means to be a public university in an era of declining state funding.

This application is a stripped and modified version of NPR's application template.

Assumptions

The following things are assumed to be true in this documentation.

  • You are running OSX.
  • You are using Python 2.7.
  • You have virtualenv installed and working.

What's in here?

The project contains the following folders and important files:

  • confs -- Server configuration files for nginx and uwsgi. Edit the templates then fab <ENV> servers.render_confs, don't edit anything in confs/rendered directly.
  • data -- Data files, such as those used to generate HTML.
  • fabfile -- Fabric commands for automating setup, deployment, data processing, etc.
  • etc -- Miscellaneous scripts and metadata for project bootstrapping.
  • jst -- Javascript (Underscore.js) templates.
  • less -- LESS files, will be compiled to CSS and concatenated for deployment.
  • templates -- HTML (Jinja2) templates, to be compiled locally.
  • tests -- Python unit tests.
  • www -- Static and compiled assets to be deployed. (a.k.a. "the output")
  • www/test -- Javascript tests and supporting files.
  • app.py -- A Flask app for rendering the project locally.
  • app_config.py -- Global project configuration for scripts, deployment, etc.
  • render_utils.py -- Code supporting template rendering.
  • requirements.txt -- Python requirements.
  • static.py -- Static Flask views used in both app.py and public_app.py.

Bootstrap the project

Node.js is required for the static asset pipeline. If you don't already have it, get it like this:

brew install node
curl https://npmjs.org/install.sh | sh

Then bootstrap the project:

cd public-trust
source bin/activate
pip install -r requirements.txt
npm install
fab update

Hide project secrets

Project secrets should never be stored in app_config.py or anywhere else in the repository. They will be leaked to the client if you do. Instead, always store passwords, keys, etc. in environment variables and document that they are needed here in the README.

Run the project

A flask app is used to run the project locally. It will automatically recompile templates and assets on demand.

fab app

Visit localhost:8000 in your browser.

Compile static assets

Compile LESS to CSS, compile javascript templates to Javascript and minify all assets:

fab render

(This is done automatically whenever you deploy to S3.)

Test the rendered app

If you want to test the app once you've rendered it out, just use the Python webserver:

cd www
python -m SimpleHTTPServer

Deploy to S3

fab staging master deploy

About

In an era of diminishing state support, what makes UC Berkeley a public institution?

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 73.3%
  • CSS 14.5%
  • Python 8.1%
  • HTML 4.1%