Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
* add/updated bits that will make it easier for the next person to
  set up a dev environment
* fixed formatting so it's easier to read in text form
  • Loading branch information
willkg committed Feb 8, 2013
1 parent 8bd9e08 commit 4b4564e
Showing 1 changed file with 65 additions and 26 deletions.
91 changes: 65 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,43 @@ For project goals, specifications, etc., check out the
[Django]: http://www.djangoproject.com/
[wikimo]: https://wiki.mozilla.org/Firefox/Input


Getting Started
---------------

### Git

Get the code:

git clone git@github.com:mozilla/input.mozilla.org.git input-site

Make sure that the directory it creates is not input.mozilla.org because
manage.py adds the top-level directory to the PYTHONPATH and then it
thinks that input.mozilla.org is a Python module and then it all breaks.


### Python
You need Python 2.6. Also, you probably want to run this application in a

You need Python 2.6.

Also, you probably want to run this application in a
[virtualenv][virtualenv] environment.

Run
Run:

easy_install pip

followed by
followed by:

pip install -r requirements/prod.txt -r requirements/compiled.txt

to install the required Python libraries.

[virtualenv]: http://pypi.python.org/pypi/virtualenv

### Highcharts

Due to licensing issues, we can't rightfully bundle highcharts.js. So you can
go get it using `./manage.py cron get_highcharts`.

### Sphinx

For searching, we use [Sphinx][sphinx]. Set up an instance of it, and adjust
the SPHINX\_\* settings in settings.py to match your setup.

[sphinx]: http://www.sphinxsearch.com/

### Django

Put your database settings in `settings_local.py`:

from settings import *
Expand All @@ -52,8 +58,8 @@ Put your database settings in `settings_local.py`:
'default': {
'ENGINE': 'mysql',
'NAME': 'firefox_input',
'USER': 'root',
'PASSWORD': '',
'USER': 'input',
'PASSWORD': 'input',
'HOST': 'localhost',
'PORT': '',
'OPTIONS': {'init_command': 'SET storage_engine=InnoDB',
Expand All @@ -67,43 +73,73 @@ Put your database settings in `settings_local.py`:
}
}

To initialize the database, run:
Make sure you create the database and user you've specified:

$ mysql -u root -p
mysql> CREATE DATABASE firefox_input;
mysql> GRANT ALL ON firefox_input.* TO input@localhost IDENTIFIED BY 'input';
mysql> GRANT ALL ON test_firefox_input.* TO input@localhost IDENTIFIED BY 'input';
mysql> CREATE DATABASE website_issues;
mysql> GRANT ALL ON website_issues.* TO input@localhost IDENTIFIED BY 'input';
mysql> GRANT ALL ON test_website_issues.* TO input@localhost IDENTIFIED BY 'input';

DJANGO_SETTINGS_MODULE=settings To initialize the database, run:

./manage.py syncdb
$ ./manage.py syncdb

To update your schemas from an earlier version:

schematic migrations
$ DJANGO_SETTINGS_MODULE=settings ./vendor/src/schematic/schematic migrations

To initialize the search index, run:

./manage.py update_index
$ ./manage.py update_index

The Internet has plenty of of documentation on setting up a Django application
with any web server. If you need a wsgi entry point, you can find one in
``wsgi/reporter.wsgi``.


### Highcharts

Due to licensing issues, we can't rightfully bundle highcharts.js. So you can
go get it using:

$ ./manage.py cron get_highcharts


### Sphinx

For searching, we use [Sphinx][sphinx]. Set up an instance of it, and adjust
the SPHINX\_\* settings in settings.py to match your setup.

[sphinx]: http://www.sphinxsearch.com/


### Sites data

The "website\_issues" database has to be a separate SQL-database from
"default", as it uses its own schematic migration version.
It is used to load aggregate website issues (generated by clustering) from a
cron task. To initialize it, run:

./manage.py syncdb --database=website_issues
$ ./manage.py syncdb --database=website_issues

To generate site data yourself without getting it pushed from metrics, run
To generate site data yourself without getting it pushed from metrics, run:

./manage.py generate_sites
$ ./manage.py generate_sites

And for schema updates:

schematic migrations/sites
$ DJANGO_SETTINGS_MODULE=settings ./vendor/src/schematic/schematic migrations/sites


### Cron jobs

There are two jobs you may want to run periodically:

./manage.py update_product_details # Mozilla Product Details update
./manage.py update_index -r # update and rotate search index
$ ./manage.py update_product_details # Mozilla Product Details update
$ ./manage.py update_index -r # update and rotate search index

The frequency is up to you, but you probably want to run the search index
updates relatively frequently, while the product details can wait a little
Expand All @@ -115,7 +151,9 @@ periodically, you should leave ``lib/product_details_json`` untouched, but
create a new directory somewhere else and change the setting
``PROD_DETAILS_DIR`` accordingly.


### Mobile vs. Desktop site

We are using the [Django Sites Framework][sites] to distinguish between the
mobile site and the desktop site. The default is site ID 1 == desktop. If
you create another site using the admin interface, requests for that site's
Expand All @@ -131,6 +169,7 @@ Make sure to include the port (``m.localhost:8000``).

License
-------

This software is licensed under the [Mozilla Tri-License][MPL]:

***** BEGIN LICENSE BLOCK *****
Expand Down

0 comments on commit 4b4564e

Please sign in to comment.