2014-10-28 17:43:16 +03:00
Sugardough
2014-10-28 17:45:08 +03:00
==========
2014-10-28 14:01:09 +03:00
2018-06-18 10:25:36 +03:00
**Sugardough is not activelly maintained and packages are out of date and insecure.**
2014-12-04 22:33:11 +03:00
Sugardough is a web application template based on Django. Sugardough is
2016-10-27 19:30:55 +03:00
built using [Cookiecutter ](https://github.com/audreyr/cookiecutter ).
2014-10-28 17:43:16 +03:00
2014-10-28 20:09:29 +03:00
Features:
* Django settings with environment variables, using [Decouple ](https://github.com/henriquebastos/python-decouple )
2015-04-02 14:00:17 +03:00
* [Jinja2 ](http://jinja.pocoo.org/ ) template engine
2014-10-28 20:09:29 +03:00
* [Whitenoise ](http://whitenoise.evans.io/ )
2015-04-20 12:16:26 +03:00
* [Docker ](https://docker.io/ ) ready, plus [Docker Compose ](https://github.com/docker/compose ) support.
2014-10-28 20:09:29 +03:00
* Sane [Flake8 ](http://flake8.readthedocs.org/en/2.2.3/ ) configuration.
* [NewRelic ](https://newrelic.com/ ) ready.
* [Travis-CI ](http://travis-ci.org/ ) ready.
* [Coveralls ](http://coveralls.io/ ) ready.
2014-11-06 20:48:54 +03:00
* [Sphinx ](http://sphinx-doc.org/ ) support and [ReadTheDocs ](https://readthedocs.org/ ) ready.
2014-12-04 22:33:11 +03:00
* [peep ](https://github.com/erikrose/peep ) ready.
2015-04-22 10:47:35 +03:00
* [session-csrf ](https://github.com/mozilla/django-session-csrf ) included.
2014-10-28 20:09:29 +03:00
2014-12-08 22:27:35 +03:00
[![Requirements Status ](https://img.shields.io/requires/github/mozilla/sugardough.svg )](https://requires.io/github/mozilla/sugardough/requirements/?branch=master)
2015-11-18 15:12:28 +03:00
Virtualenv
2014-12-08 22:27:35 +03:00
[![Build Status ](https://img.shields.io/travis/mozilla/sugardough/master.svg )](https://travis-ci.org/mozilla/sugardough)
2015-11-18 15:12:28 +03:00
Docker
[![Build Status ](https://ci.us-west.moz.works/buildStatus/icon?job=sugardough )](https://ci.us-west.moz.works/job/sugardough)
2014-12-08 22:27:35 +03:00
2014-11-24 13:27:38 +03:00
2014-10-28 17:43:16 +03:00
Create a sugardough project
2014-10-28 17:45:08 +03:00
---------------------------
2014-10-28 17:43:16 +03:00
1. Get cookiecutter:
2015-02-04 22:11:08 +03:00
```sh
$ pip install cookiecutter
```
2014-10-28 17:43:16 +03:00
2. Run cookiecutter with sugardough template
2015-02-04 22:11:08 +03:00
```sh
$ cookiecutter https://github.com/mozilla/sugardough
```
2014-10-28 17:43:16 +03:00
3. Done!
2015-04-21 23:37:30 +03:00
Contribute to sugardough
------------------------
2014-10-28 17:43:16 +03:00
To contribute to sugardough development:
2015-02-04 22:11:08 +03:00
1. Clone this repository
2. Create a [virtualenv ](https://virtualenv.pypa.io/en/latest/ ).
3. Install development requirements using pip:
```sh
$ pip install -r requirements.txt
```
4. Update the [template directory], and [cookiecutter.json] as well with new
variables if needed.
5. Run the regeneration script that auto-creates a test site:
```sh
$ ./bin/regenerate.py
```
6. Launch the test site to see your changes:
```sh
$ cd test_project/sugardough
2015-04-20 12:16:26 +03:00
$ docker-compose up
2015-02-04 22:11:08 +03:00
```
6. Git commit changes.
7. Pull request!
[template directory]: https://github.com/mozilla/sugardough/tree/master/%7B%7B%20cookiecutter.project_name%20%7D%7D
[cookiecutter.json]: https://github.com/mozilla/sugardough/blob/master/cookiecutter.json
The `regenerate.py` command can also watch for changes and auto-regenerate the
test project:
```sh
$ ./bin/regenerate.py --watch
```
If you want the test project to use a different value for a variable than the
default defined in `cookiecutter.json` , add the value to your
`~/.cookiecutterrc` file:
```
default_context:
project_name: "Foo Bar"
```
2014-12-05 23:43:37 +03:00
Opinions
--------
* If you want to change the rules for **PEP8** , go and edit the `setup.cfg` file.
* If you want to use **MySQL** instead of PostgreSQL (which is default),
edit the generated `requirements.txt` file and remove the lines about
`psycopg2` then use `peep` to add the version of `MySQL-python` you want to
use. You will also need to edit the `.travis.yml` file accordingly.
2015-04-06 14:40:43 +03:00
* if you want to use **pytest** add in requirements.txt `pytest` , `py` ,
`cov-core` and `pytest-django` .
2014-12-05 23:43:37 +03:00
For test coverage you'll also have to add `pytest-cov` .
Next you'll need to edit the `.travis.yml` file and edit the script part.
Instead of `coverage run manage.py test` it
`py.test --cov=sugardough` .
2015-03-11 19:20:50 +03:00
2015-11-19 15:34:26 +03:00
* Dockerfile uses Python 3. If you want Python 2 change the following line
```bash
apt-get install -y --no-install-recommends build-essential python3 python3-dev python3-pip \
```
to
```bash
apt-get install -y --no-install-recommends build-essential python python-dev python-pip
```
and remove the next two lines starting with `RUN update-alternatives` .
2015-04-20 14:01:27 +03:00
2015-04-06 14:40:43 +03:00
2015-03-11 19:20:50 +03:00
License
-------
Sugardough itself is licensed under the [Apache 2 license ](http://www.apache.org/licenses/LICENSE-2.0 ). See the [LICENSE ](LICENSE ) file in this repository for the full text of the license. The website projects produced using sugardough use the [Mozilla Public License version 2 ](https://www.mozilla.org/MPL/2.0/ ) by default.