-
Notifications
You must be signed in to change notification settings - Fork 9
Update README #61
Update README #61
Changes from 2 commits
e850f77
742d641
cf0903a
e17e07a
097d4ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,32 +3,95 @@ | |
[![Build Status](https://travis-ci.org/cfpb/eregs-2.0.svg?branch=master)](https://travis-ci.org/cfpb/eregs-2.0) | ||
[![Coverage Status](https://coveralls.io/repos/github/cfpb/eregs-2.0/badge.svg?branch=master)](https://coveralls.io/github/cfpb/eregs-2.0?branch=master) | ||
|
||
This is the new version of eRegs. | ||
Work in progress. This is an updated back-end for consumerfinance.gov/eregulations | ||
|
||
## Installation | ||
[Documentation](https://cfpb.github.io/eregs-2.0/) | ||
|
||
To make it go, you'll need MySQL. Create a user named `eregs` and give that user sufficient privileges to run | ||
migrations (`alter user eregs superuser` should be fine for development). pip install the requirements and run the migrations. | ||
## Development Quick-start | ||
|
||
You'll need some sample data, so check the `data` directory for the initial version of Reg C, or check out the entire | ||
[regulations-xml](https://github.com/cfpb/regulations-xml) repository. Load Reg C into the database by running | ||
Create a MySQL database named `eregs` with a priviledged user named `eregs`, password `eregs`, then: | ||
|
||
`./manage.py import_xml path/to/2011-31712.xml` | ||
``` | ||
mkvirtualenv eregs | ||
workon eregs | ||
pip install -r requirements.txt | ||
./manage.py import_xml data/2011-31712.xml | ||
./setup.sh | ||
./manage.py runserver | ||
``` | ||
|
||
This should take no more than 10 seconds and will populate the database with the first version of Reg C. `./manage.py runserver` and | ||
visit http://localhost:8000 to get the initial eRegs screen. Click on `Reg C` and it'll take you to the first section. | ||
|
||
## Working on the front-end | ||
## Detailed installation | ||
|
||
The installation instructions will guide you through cloning the repo, setting up the database, importing an initial regulation, and building the front-end. Additional instructions can be found in the project's [documentation](https://cfpb.github.io/eregs-2.0/) | ||
|
||
### Dependencies | ||
|
||
- Python >= 2.6 | ||
- Node >= 4 | ||
- MySQL | ||
- ElasticSearch 2.3 | ||
|
||
MySQL and ElasticSearch can be installed using `homebrew`: | ||
|
||
``` | ||
brew install mysql | ||
brew install elasticsearch23 | ||
``` | ||
|
||
### Initial setup | ||
|
||
Clone the repository, create a Python virtualenv, and install the project's dependencies. | ||
|
||
``` | ||
git clone https://github.com/cfpb/eregs-2.0 | ||
cd eregs-2.0 | ||
mkvirtualenv eregs | ||
workon eregs | ||
pip install -r requirements.txt | ||
``` | ||
|
||
### Database setup (for development) | ||
|
||
Login to MySQL and create a database named `eregs` with an `eregs` superuser. | ||
|
||
``` | ||
mysql -u root -p | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You do need to log in to MySQL somehow, though. I think it's a safe assumption that anyone doing local development and installing MySQL via homebrew has root access to it; if they have a non-blank password, they'll be prompted so I don't think this is a problem. |
||
mysql> CREATE DATABASE IF NOT EXISTS eregs; | ||
mysql> CREATE DATABASE IF NOT EXISTS test_eregs; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line should be removed as this database is created by Django automatically when unit tests are run. |
||
mysql> CREATE USER 'eregs'@'localhost' IDENTIFIED BY 'eregs'; | ||
mysql> GRANT ALL PRIVILEGES ON eregs.* TO 'eregs'@'localhost'; | ||
mysql> GRANT ALL PRIVILEGES ON test_eregs.* TO 'eregs'@'localhost'; | ||
mysql> FLUSH PRIVILEGES; | ||
``` | ||
|
||
|
||
### Import a regulation | ||
|
||
The application requires [regulation xml](https://github.com/cfpb/regulations-xml) data. To simplify development, sample data has been provided. To load the sample data into the database run: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use term "RegML" instead/in addition? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe say, "RegML-compliant xml." |
||
|
||
``` | ||
./manage.py import_xml data/2011-31712.xml | ||
``` | ||
|
||
This will populate the database with the first version of CFPB's regulation C C. | ||
|
||
### Build the front-end | ||
|
||
1. Install [Node.js](http://nodejs.org) v4 or greater. | ||
1. `./setup.sh` will install dependencies and build the project. | ||
|
||
After the initial set-up: | ||
For front-end development, after the initial set-up: | ||
|
||
- `npm run build` - Bundle and minify all front-end assets. | ||
- `npm run watch` - Bundle Less and JS files whenever they're changed. | ||
- `npm test` - Run JS unit tests and lint source files. | ||
|
||
### Run the application | ||
|
||
To run the application, run `./manage.py runserver` and | ||
visit http://localhost:8000 to get the initial eRegulations screen. | ||
|
||
## Open source licensing info | ||
|
||
1. [TERMS](TERMS.md) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this a full link, e.g. https://www.consumerfinance.gov/eregulations/?