<commit_before>Robotix
==============================

The website for Robotix 2016

.. image:: https://travis-ci.org/Robotix/Robotix.svg?branch=master?style=flat
    :target: https://travis-ci.org/Robotix/Robotix
.. image:: https://landscape.io/github/Robotix/Robotix/master/landscape.svg?style=flat
   :target: https://landscape.io/github/Robotix/Robotix/master
   :alt: Code Health
.. image:: https://coveralls.io/repos/Robotix/Robotix/badge.svg?style=flat
    :target: https://coveralls.io/r/Robotix/Robotix 

*LICENSE*: BSD

Settings
------------

Robotix relies extensively on environment settings which **will not work with Apache/mod_wsgi setups**. It has been deployed successfully with both Gunicorn/Nginx and even uWSGI/Nginx.

For configuration purposes, the following table maps the 'Robotix' environment variables to their Django setting:

======================================= =========================== ============================================== ======================================================================
Environment Variable                    Django Setting              Development Default                            Production Default
======================================= =========================== ============================================== ======================================================================
DJANGO_AWS_ACCESS_KEY_ID                AWS_ACCESS_KEY_ID           n/a                                            raises error
DJANGO_AWS_SECRET_ACCESS_KEY            AWS_SECRET_ACCESS_KEY       n/a                                            raises error
DJANGO_AWS_STORAGE_BUCKET_NAME          AWS_STORAGE_BUCKET_NAME     n/a                                            raises error
DJANGO_CACHES                           CACHES (default)            locmem                                         memcached
DJANGO_DATABASES                        DATABASES (default)         See code                                       See code
DJANGO_DEBUG                            DEBUG                       True                                           False
DJANGO_SECRET_KEY                       SECRET_KEY                  CHANGEME!!!                                    raises error
DJANGO_SECURE_BROWSER_XSS_FILTER        SECURE_BROWSER_XSS_FILTER   n/a                                            True
DJANGO_SECURE_SSL_REDIRECT              SECURE_SSL_REDIRECT         n/a                                            True
DJANGO_SECURE_CONTENT_TYPE_NOSNIFF      SECURE_CONTENT_TYPE_NOSNIFF n/a                                            True
DJANGO_SECURE_FRAME_DENY                SECURE_FRAME_DENY           n/a                                            True
DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS   HSTS_INCLUDE_SUBDOMAINS     n/a                                            True
DJANGO_SESSION_COOKIE_HTTPONLY          SESSION_COOKIE_HTTPONLY     n/a                                            True
DJANGO_SESSION_COOKIE_SECURE            SESSION_COOKIE_SECURE       n/a                                            False
DJANGO_EMAIL_BACKEND                    EMAIL_BACKEND               django.core.mail.backends.console.EmailBackend django.core.mail.backends.smtp.EmailBackend
DJANGO_EMAIL_HOST                       EMAIL_HOST                  localhost                                      smtp.sendgrid.com
EMAIL_PORT                              EMAIL_PORT                  1025                                           587
SENDGRID_USERNAME                       EMAIL_HOST_USER             n/a                                            raises error
SENDGRID_PASSWORD                       EMAIL_HOST_PASSWORD         n/a                                            raises error
DJANGO_DEFAULT_FROM_EMAIL               DEFAULT_FROM_EMAIL          n/a                                            "Robotix <<EMAIL>>"
EMAIL_SUBJECT_PREFIX                    EMAIL_SUBJECT_PREFIX        n/a                                            "[Robotix] "
======================================= =========================== ============================================== ======================================================================

* TODO: Add vendor-added settings in another table

Getting up and contributing
---------------------------

The steps below will get you up and running with a local development environment. We assume you have the following installed:

* Python 2.7.10
* pip
* virtualenv
* PostgreSQL

1. Fork the `Robotix` repo on GitHub.

2. Clone your fork locally::

    $ git clone git@github.com:your_name_here/Robotix.git

3. Install Linux OS dependencies::

    $ sudo ./install_os_dependencies.sh install

4. Install your local copy into a virtualenv__. This is how you set up your fork for local development::

    $ virtualenv .virtualenv --python=<path_to_python2.7.10>
    $ source ./.virtualenv/bin/activate
    $ ./install_python_dependencies.sh

.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/
Further help: http://stackoverflow.com/questions/5506110/is-it-possible-to-install-another-version-of-python-to-virtualenv

5. You can now run the ``runserver_plus`` command::

    $ python manage.py runserver_plus

The base app will run but you'll need to carry out a few steps to make the sign-up and login forms work. These are currently detailed in `issue #39`_.

.. _issue #39: https://github.com/pydanny/cookiecutter-django/issues/39

6. Create a branch for local development::

    $ git checkout -b name-of-your-bugfix-or-feature

7. When you're done making changes, check that your changes pass flake8, pep8 and the tests::

    $ make lint
    $ make pep8
    $ make test

8. Commit your changes and push your branch to GitHub::

    $ git add .
    $ git commit -m "Your detailed description of your changes."
    $ git push origin name-of-your-bugfix-or-feature

9. Submit a pull request through the GitHub website.

**Live reloading and Sass CSS compilation**

If you'd like to take advantage of live reloading and Sass / Compass CSS compilation you can do so with the included Grunt task.

Make sure that nodejs_ is installed. Then in the project root run::

    $ npm install grunt

.. _nodejs: http://nodejs.org/download/

Now you just need::

    $ grunt serve<commit_msg>Add setting up the database instructions to the README<commit_after>Robotix
==============================

The website for Robotix 2016

.. image:: https://travis-ci.org/Robotix/Robotix.svg?branch=master?style=flat
    :target: https://travis-ci.org/Robotix/Robotix
.. image:: https://landscape.io/github/Robotix/Robotix/master/landscape.svg?style=flat
   :target: https://landscape.io/github/Robotix/Robotix/master
   :alt: Code Health
.. image:: https://coveralls.io/repos/Robotix/Robotix/badge.svg?style=flat
    :target: https://coveralls.io/r/Robotix/Robotix 

*LICENSE*: BSD

Settings
------------

Robotix relies extensively on environment settings which **will not work with Apache/mod_wsgi setups**. It has been deployed successfully with both Gunicorn/Nginx and even uWSGI/Nginx.

For configuration purposes, the following table maps the 'Robotix' environment variables to their Django setting:

======================================= =========================== ============================================== ======================================================================
Environment Variable                    Django Setting              Development Default                            Production Default
======================================= =========================== ============================================== ======================================================================
DJANGO_AWS_ACCESS_KEY_ID                AWS_ACCESS_KEY_ID           n/a                                            raises error
DJANGO_AWS_SECRET_ACCESS_KEY            AWS_SECRET_ACCESS_KEY       n/a                                            raises error
DJANGO_AWS_STORAGE_BUCKET_NAME          AWS_STORAGE_BUCKET_NAME     n/a                                            raises error
DJANGO_CACHES                           CACHES (default)            locmem                                         memcached
DJANGO_DATABASES                        DATABASES (default)         See code                                       See code
DJANGO_DEBUG                            DEBUG                       True                                           False
DJANGO_SECRET_KEY                       SECRET_KEY                  CHANGEME!!!                                    raises error
DJANGO_SECURE_BROWSER_XSS_FILTER        SECURE_BROWSER_XSS_FILTER   n/a                                            True
DJANGO_SECURE_SSL_REDIRECT              SECURE_SSL_REDIRECT         n/a                                            True
DJANGO_SECURE_CONTENT_TYPE_NOSNIFF      SECURE_CONTENT_TYPE_NOSNIFF n/a                                            True
DJANGO_SECURE_FRAME_DENY                SECURE_FRAME_DENY           n/a                                            True
DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS   HSTS_INCLUDE_SUBDOMAINS     n/a                                            True
DJANGO_SESSION_COOKIE_HTTPONLY          SESSION_COOKIE_HTTPONLY     n/a                                            True
DJANGO_SESSION_COOKIE_SECURE            SESSION_COOKIE_SECURE       n/a                                            False
DJANGO_EMAIL_BACKEND                    EMAIL_BACKEND               django.core.mail.backends.console.EmailBackend django.core.mail.backends.smtp.EmailBackend
DJANGO_EMAIL_HOST                       EMAIL_HOST                  localhost                                      smtp.sendgrid.com
EMAIL_PORT                              EMAIL_PORT                  1025                                           587
SENDGRID_USERNAME                       EMAIL_HOST_USER             n/a                                            raises error
SENDGRID_PASSWORD                       EMAIL_HOST_PASSWORD         n/a                                            raises error
DJANGO_DEFAULT_FROM_EMAIL               DEFAULT_FROM_EMAIL          n/a                                            "Robotix <<EMAIL>>"
EMAIL_SUBJECT_PREFIX                    EMAIL_SUBJECT_PREFIX        n/a                                            "[Robotix] "
======================================= =========================== ============================================== ======================================================================

* TODO: Add vendor-added settings in another table

Getting up and contributing
---------------------------

The steps below will get you up and running with a local development environment. We assume you have the following installed:

* Python 2.7.10
* pip
* virtualenv
* PostgreSQL

1. Fork the `Robotix` repo on GitHub.

2. Clone your fork locally::

    $ git clone <EMAIL>:your_name_here/Robotix.git

3. Install Linux OS dependencies::

    $ sudo ./install_os_dependencies.sh install

4. Install your local copy into a virtualenv__. This is how you set up your fork for local development::

    $ virtualenv .virtualenv --python=<path_to_python2.7.10>
    $ source ./.virtualenv/bin/activate
    $ ./install_python_dependencies.sh

.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/
Further help: http://stackoverflow.com/questions/5506110/is-it-possible-to-install-another-version-of-python-to-virtualenv

5. Configure the DATABASE_URL environment variable::

    $ sudo -u postgres psql
    postgres=# ALTER USER postgres WITH PASSWORD '<PASSWORD>';
    postgres=# CREATE DATABASE robotix;
    postgres=# \q
    $ export DATABASE_URL='postgres://postgres:robotix@localhost:5432/robotix'

6. Run the migrations to create the database schema::

    $ python manage.py migrate

7. You can now run the ``runserver_plus`` command::

    $ python manage.py runserver_plus

The base app will run but you'll need to carry out a few steps to make the sign-up and login forms work. These are currently detailed in `issue #39`_.

.. _issue #39: https://github.com/pydanny/cookiecutter-django/issues/39

8. Create a branch for local development::

    $ git checkout -b name-of-your-bugfix-or-feature

9. When you're done making changes, check that your changes pass flake8, pep8 and the tests::

    $ make lint
    $ make pep8
    $ make test

10. Commit your changes and push your branch to GitHub::

    $ git add .
    $ git commit -m "Your detailed description of your changes."
    $ git push origin name-of-your-bugfix-or-feature

11. Submit a pull request through the GitHub website.

**Live reloading and Sass CSS compilation**

If you'd like to take advantage of live reloading and Sass / Compass CSS compilation you can do so with the included Grunt task.

Make sure that nodejs_ is installed. Then in the project root run::

    $ npm install grunt

.. _nodejs: http://nodejs.org/download/

Now you just need::

    $ grunt serve
{'fraction_non_alphanumeric': 0.14533722538024274, 'fraction_numerical': 0.007374404670456291, 'mean_word_length': 1.8701499118165785, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 80, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3562858', 'n_tokens_mistral': 3371, 'n_tokens_neox': 3100, 'n_words': 880}