GithubHelp home page GithubHelp logo

isabella232 / mdc-inspectors-dashboard Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codeforamerica/mdc-inspectors-dashboard

0.0 0.0 0.0 10.27 MB

[MDC Fellowship 2015] Clone of mdc-feedback, fed by mdc-inspectors

Home Page: https://mdc-inspectors-dashboard.herokuapp.com/

License: MIT License

Makefile 0.13% Python 13.70% CSS 7.34% JavaScript 67.32% HTML 11.29% Ruby 0.16% Mako 0.07%

mdc-inspectors-dashboard's Introduction

mdc-feedback

[MDC Fellowship 2015] Feedback Engine. Details TBA

Development setup

This application is built on Flask and Python. The app.py file describes the models and routes.

A lot of early development for this application was based on this tutorial, so a lot of the environment configuration and staging/live set up is based on these instructions. (For example, if you need to update the database models locally, use python manage.py db migrate -m "Initial migration".) The production service lives on Heroku. Please contact us with any questions.

Requirements

A note on VIM

If you're not used to it see VIM Adventures, because at least one of these steps requires using VIM.

Environmental variables

  • DATABASE_URL=[db connection string] — My local example is postgresql://localhost/inspectors_dev
  • CONFIG=[class name provided by config variable] — I use feedback.settings.DevelopmentConfig for staging; for developer environments, see below

Project setup

# clone the repo
git clone https://github.com/codeforamerica/mdc-feedback.git
# change into the repo directory
cd mdc-feedback
# install python dependencies
# NOTE: if you are using postgres.app, you will need to make sure to
# set your PATH to include the bin directory. For example:
# export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin/
pip install -r requirements.txt
  • Set up a new database (not using Postgres.app):
createdb inspectors_dev
python app.py createdb
  • On Mac OSX, using Postgres.app, and working within psql:
CREATE USER user PASSWORD 'password';
CREATE DATABASE inspectors_dev OWNER=user;
_Feel free to replace user and password with values of your choice._
  • Inside your virtual environment, open up the postactivate file:
vi $VIRTUAL_ENV/bin/postactivate
  • Insert the following into your postactivate file:
export ADMIN_EMAIL='[email protected]'
export CONFIG="feedback.settings.DevelopmentConfig"
export DATABASE_URL="postgresql://localhost/inspectors_dev"
  • Reboot your virtual environment. (I use workon mdc-feedback, but your mileage will vary)

  • Upgrade your database in the virtual environment

python manage.py db upgrade
  • Start the server
python manage.py server
  • Visit localhost:9000 in your browser to see the results
http://localhost:9000
  • After installing Compass, run compass watch inside your Compass directory, so that Compass will automatically compile your .scss files into .css.

  • This repo uses Google Sheets as an information source for the 'what is this' UI on the dashboard. Tabletop.js is included in the repo, but you still need to publish your Sheet to web and replace the URL found in dashboard.js to enable this functionality.

Deployment

Deployment is typically on Heroku. Follow this tutorial for basic information on how to setup the project.

Environmental variables

Project setup

email:

The app uses Flask-Mail to handle sending emails. This includes emails about subscriptions to various contracts, notifications about contracts being followed, and others. In production, the app relies on Sendgrid, but in development, it uses the Gmail SMTP server. If you don't need to send emails, you can disable emails by setting MAIL_SUPPRESS_SEND = True in the DevConfig configuration object.

If you would like to send email over the Gmail SMTP server, you will need to add two environmental variables: MAIL_USERNAME and MAIL_PASSWORD.

login and user accounts

Right now, the app uses persona to handle authentication. The app uses its own user database to manage roles and object-based authorization. You will need to sign in through persona and then enter yourself into the database in order to have access to admin and other pages.

A manage task has been created to allow you to quickly create a user to access the admin and other staff-only tasks. To add an email, run the following command (NOTE: if you updated your database as per above, you will probably want to give youself a role of 1, which will give you superadmin privledges), putting your email/desired role in the appropriate places:

python manage.py seed_user -e <your-email-here> -r <your-desired-role>

Now, logging in through persona should also give you access to the app.

Tests

In order to run the tests, you will need to create a test database. You can follow the same procedures outlined in the install section. By default, the database should be named purchasing_test:

psql
create database feedback_test;

Tests are located in the feedback_test directory. To run the tests, run

PYTHONPATH=. nosetests feedback_test/

from inside the root directory. For more coverage information, run

PYTHONPATH=. nosetests feedback_test/ -v --with-coverage --cover-package=purchasing_test --cover-erase

Migrations

Migrations are handled through flask-migrate

Contacts

  • Ernie Hsiung
  • Sophia Dengo
  • Mathias Gibson

mdc-inspectors-dashboard's People

Contributors

ernieatlyd avatar phiden avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.