Skip to content

Commit df26f4d

Browse files
committed
docs: improve docs and add contribution guidelines (#265)
1 parent ab9e374 commit df26f4d

File tree

3 files changed

+123
-79
lines changed

3 files changed

+123
-79
lines changed

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Contribution guide
2+
3+
First of all, thank you for taking the time to contribute! 🎉
4+
5+
When contributing to [this project](https://github.com/engineervix/cookiecutter-wagtail-vix), please first create an [issue](https://github.com/engineervix/cookiecutter-wagtail-vix/issues) to discuss the change you wish to make before making a change.
6+
7+
## Before making a pull request
8+
9+
1. Fork [the repository](https://github.com/engineervix/cookiecutter-wagtail-vix).
10+
2. Clone the repository from your GitHub.
11+
3. Check out a new branch and add your modification.
12+
4. Write tests, and ensure that they pass.
13+
5. Update `README.md` for your changes. Please make sure that the Table of Contents is up to date. [DocToc](https://github.com/thlorenz/doctoc) makes this pretty easy, as you simply run `doctoc README.md` (You can install it globally on your system via `npm install -g doctoc`).
14+
6. Commit your changes via `cz commit`, following the prompts to appropriately categorize your commit.
15+
7. Send a [pull request](https://github.com/engineervix/cookiecutter-wagtail-vix/pulls) 🙏

README.md

Lines changed: 108 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,66 @@
1-
# cookiecutter-wagtail-vix
2-
3-
[![CircleCI](https://circleci.com/gh/engineervix/cookiecutter-wagtail-vix/tree/master.svg?style=svg)](https://circleci.com/gh/engineervix/cookiecutter-wagtail-vix/tree/master)
4-
[![Coverage Status](https://coveralls.io/repos/github/engineervix/cookiecutter-wagtail-vix/badge.svg?branch=master)](https://coveralls.io/github/engineervix/cookiecutter-wagtail-vix?branch=master)
5-
[![python3](https://img.shields.io/badge/python-3.6%20%7C%203.7%20%7C%203.8-brightgreen.svg)](https://python3statement.org/#sections50-why)
6-
[![Requirements Status](https://requires.io/github/engineervix/cookiecutter-wagtail-vix/requirements.svg?branch=master)](https://requires.io/github/engineervix/cookiecutter-wagtail-vix/requirements/?branch=master)
7-
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
8-
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
9-
[![License: MIT](https://img.shields.io/github/license/engineervix/cookiecutter-wagtail-vix)](https://github.com/engineervix/cookiecutter-wagtail-vix/LICENSE)
1+
<h1 align="center">Welcome to cookiecutter-wagtail-vix 👋</h1>
2+
3+
<p align="center">
4+
<a href="https://circleci.com/gh/engineervix/cookiecutter-wagtail-vix/tree/master" target="_blank">
5+
<img src="https://circleci.com/gh/engineervix/cookiecutter-wagtail-vix/tree/master.svg?style=svg" alt="CircleCI">
6+
</a>
7+
<a href="https://coveralls.io/github/engineervix/cookiecutter-wagtail-vix?branch=master" target="_blank">
8+
<img src="https://coveralls.io/repos/github/engineervix/cookiecutter-wagtail-vix/badge.svg?branch=master" alt="Coverage Status">
9+
</a>
10+
<a href="https://img.shields.io/badge/python-3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-brightgreen.svg" target="_blank">
11+
<img src="https://python3statement.org/#sections50-why" alt="python3">
12+
</a>
13+
<a href="https://requires.io/github/engineervix/cookiecutter-wagtail-vix/requirements.svg?branch=master" target="_blank">
14+
<img src="https://requires.io/github/engineervix/cookiecutter-wagtail-vix/requirements.svg?branch=master" alt="Requirements Status">
15+
</a>
16+
<a href="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/psf/black" target="_blank">
17+
<img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code style: black">
18+
</a>
19+
<a href="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/pre-commit/pre-commit" target="_blank">
20+
<img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white" alt="pre-commit">
21+
</a>
22+
<a href="/engineervix/cookiecutter-wagtail-vix/LICENSE" target="_blank">
23+
<img src="https://img.shields.io/github/license/engineervix/cookiecutter-wagtail-vix" alt="License: MIT">
24+
</a>
25+
</p>
26+
27+
> a batteries-included, reusable Wagtail project skeleton to serve as a starting point for a CMS-based website project.
28+
29+
<p align="center">
30+
<img src="https://github.com/engineervix/cookiecutter-wagtail-vix/blob/master/docs/img/homepage_screenshot.png" alt="demo.gif">
31+
</p>
1032

1133
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
1234
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
1335
**Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
1436

15-
- [What is this ❓](#what-is-this-)
16-
- [:tada: Features](#tada-features)
17-
- [:wrench: Prerequisites](#wrench-prerequisites)
18-
- [:anchor: Core](#anchor-core)
19-
- [🕶 Continuous Integration](#%F0%9F%95%B6-continuous-integration)
20-
- [:computer: Setup](#computer-setup)
21-
- [⌨️ to get started](#-to-get-started)
22-
- [⚙️ other steps](#-other-steps)
23-
- [git workflow](#git-workflow)
24-
- [Python Code Formatting](#python-code-formatting)
25-
- [:+1: Credits](#1-credits)
26-
- [✍️ To do](#%EF%B8%8F-to-do)
37+
- [Features ✨](#features-)
38+
- [Dev Setup 💻](#dev-setup-)
39+
- [First things first](#first-things-first)
40+
- [Getting Started](#getting-started)
41+
- [Other Steps](#other-steps)
42+
- [git Workflow](#git-workflow)
43+
- [Python Code Formatting](#python-code-formatting)
44+
- [TODO ✅](#todo-)
2745
- [Automation](#automation)
2846
- [Testing and Code Quality](#testing-and-code-quality)
2947
- [CI/CD / Production](#cicd--production)
3048
- [Project Features](#project-features)
3149
- [Misc](#misc)
3250
- [Done](#done)
3351
- [Deprecated](#deprecated)
34-
- [📋 Reference](#-reference)
52+
- [Contributing 🤝](#contributing-)
53+
- [Show your support](#show-your-support)
54+
- [Credits 👏](#credits-)
55+
- [Reference 📋](#reference-)
56+
- [Author](#author)
57+
- [License 📝](#license-)
3558

3659
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
3760

38-
## What is this ❓
39-
40-
This is my take on creating a reusable (and heavily opinionated) [Wagtail 2.1x](https://docs.wagtail.io/en/stable/releases/2.12.html) / [Django 3.x](https://docs.djangoproject.com/en/3.1/releases/) project skeleton using [cookiecutter](https://github.com/audreyr/cookiecutter).
41-
42-
This cookiecutter template is mostly a reflection of my personal preferences. It does, however, try to employ "best practices", for example, the [12-factor-app](https://12factor.net/) and [Daniel Greenfeld’s **Cookiecutter Django** framework](https://github.com/pydanny/cookiecutter-django). I also got a lot of ideas from some excellent wagtail-based projects, primarily [bvspca](https://github.com/nfletton/bvspca) and [bakerydemo](https://github.com/wagtail/bakerydemo).
61+
## Features ✨
4362

44-
Notwithstanding the foregoing, it is nowhere near perfect, and thus remains a work in progress. Contributions and suggestions for improvement are welcome.
45-
46-
## :tada: Features
47-
48-
- A starting point for a CMS-based website project, with so many batteries included:
63+
- An opinionated starting point for a CMS-based website project, with so many batteries included:
4964
- a homepage and "About" section, which includes addition of key personnel (with position, bio, social profiles, etc.)
5065
- a minimal functional blog with simplified categories and tags,
5166
- a contact page with contact form and location map. Includes SMS support powered by [Vonage](https://www.vonage.com/) (formerly _Nexmo_)
@@ -71,13 +86,16 @@ Notwithstanding the foregoing, it is nowhere near perfect, and thus remains a wo
7186
- [Celery](https://docs.celeryproject.org/en/stable/) ready
7287
- Documentation on setting up the project (This README and the generated project's README!)
7388
- A ready to use VSCode configuration, just update the path to your python executable in the generated `.vscode/settings.json`.
74-
- ... and so much more ...
89+
- The project comes with three Continuous Integration configurations (Simply choose one of the three and delete the others. If you don't like any of these three, feel free to use other options such as [Travis CI](https://travis-ci.org/), [Jenkins](https://jenkins.io/), etc.):
90+
- [GitLab CI](https://docs.gitlab.com/ee/ci/yaml/).
91+
- [CircleCI](https://circleci.com/),
92+
- [GitHub Actions](https://github.com/features/actions)
7593

76-
## :wrench: Prerequisites
94+
## Dev Setup 💻
7795

78-
### :anchor: Core
96+
### First things first
7997

80-
- A [\*nix](https://en.wikipedia.org/wiki/Unix-like) environment. My preference is Ubuntu (LTS version such as [18.04](https://wiki.ubuntu.com/BionicBeaver/ReleaseNotes))
98+
- A [\*nix](https://en.wikipedia.org/wiki/Unix-like) environment is highly recommended. Although you can possibly develop on Windows too (if you do, and you're using Powershell or CMD, you'll probably have to adapt some commands to suit a Windows Environment, because these docs assume you're running in a \*nix environment)
8199
- [Node.js](https://nodejs.org/) with the following packages installed **globally**:
82100
- [concurrently](https://github.com/kimmobrunfeldt/concurrently): `npm install -g concurrently`
83101
- [Browsersync](https://browsersync.io/): `npm install -g browser-sync`
@@ -91,78 +109,48 @@ Notwithstanding the foregoing, it is nowhere near perfect, and thus remains a wo
91109
- [Python3](https://www.python.org/) (3.6 and above) with [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/), [pyenv](https://github.com/pyenv/pyenv) and [pip-tools](https://github.com/jazzband/pip-tools).
92110
- The project uses the [PostgreSQL Backend](https://docs.wagtail.io/en/latest/topics/search/backends.html#postgresql-backend) for the wagtail search interface. Therefore, please ensure that Postgres (or PostGIS) are setup on your machine.
93111

94-
### 🕶 Continuous Integration
95-
96-
The project comes with three Continuous Integration configurations:
97-
98-
- [GitLab CI](https://docs.gitlab.com/ee/ci/yaml/).
99-
- [CircleCI](https://circleci.com/),
100-
- [GitHub Actions](https://github.com/features/actions)
101-
102-
Simply choose one of the three and delete the others. If you don't like any of these three, feel free to use other options such as [Travis CI](https://travis-ci.org/), [Jenkins](https://jenkins.io/), etc.
103-
104-
## :computer: Setup
105-
106-
### ⌨️ to get started
112+
### Getting Started
107113

108114
1. ensure that you have [cookiecutter](https://github.com/audreyr/cookiecutter) installed on your computer
109115
2. run `cookiecutter https://github.com/engineervix/cookiecutter-wagtail-vix.git` in your favourite shell. You’ll be prompted for some values, such as **project_name**, , **project_slug**, **email**, **wagtail_user_email** etc. A new wagtail project will be created in a folder named according to the **project_slug** at your current location.
110-
3. create a virtual environment for your project. `cd` into the project folder created above and install python dependencies: First, install [pip-tools](https://github.com/jazzband/pip-tools): `pip install pip-tools`, then run `pip-compile requirements.in` followed by `pip install -r requirements.txt`.
116+
3. create a virtual environment for your project and and `pip install --upgrade pip`. Thereafter, `cd` into the project folder created above and install python dependencies: First, install [pip-tools](https://github.com/jazzband/pip-tools): `pip install pip-tools`, then run `pip-compile requirements.in` followed by `pip-sync`.
111117
4. Now would be a good time to setup your postgres/postgis database and ensure that you update `DATABASE_URL` and the other environment variables in your `.env` files. The essential ones for starters are `RECAPTCHA_PUBLIC_KEY`, `RECAPTCHA_PRIVATE_KEY` and `MAPBOX_ACCESS_TOKEN`.
112118
5. `export ENV_PATH=.envs/.dev.env`
113-
6. `./manage.py migrate`
119+
6. `./manage.py makemigrations` followed by `./manage.py migrate`
114120
7. `./manage.py createsuperuser`. When prompted for an email address, please use the **wagtail_user_email** you specified in step 2. This is important to ensure that you don't have issues when populating the database with initial data, which is tied to the email address provided in step 2.
115121
8. `./manage.py load_initial_data`
116122
9. `yarn`
117123
10. `gulp cp`
118-
11. Prior to running tests, check the `package.json` to ensure that you have the correct postgres/postgis settings. Once you're all set, go ahead and run tests: `yarn test`.
124+
11. Prior to running tests, check `package.json` to ensure that you have the correct postgres/postgis settings. Once you're all set, go ahead and run tests: `yarn test`.
119125
12. Start the development server: `yarn dev`. Your site should be accessible at `http://127.0.0.1:3000` or `http://localhost:3000`.
120126

121-
### ⚙️ other steps
127+
### Other Steps
122128

123129
- setup version control (git) for your generated project
124130
- setup [pre-commit](https://pre-commit.com/):
125131
1. `pre-commit install`
126132
2. `pre-commit install --hook-type commit-msg`
127-
3. Update `.git/hooks/prepare-commit-msg` with the following code:
128-
129-
```
130-
#!/usr/bin/env bash
131-
exec < /dev/tty && node_modules/.bin/git-cz --hook || true
132-
```
133-
134-
4. `pre-commit run --all-files`
133+
3. `pre-commit run --all-files`
135134

136135
> :exclamation: If you are using pyenv, see <https://github.com/pre-commit/pre-commit/issues/810>. In particular, I found [this explanation](https://github.com/pre-commit/pre-commit/issues/810#issuecomment-424732161) from @thomasfowler and [this comment](https://github.com/pre-commit/pre-commit/issues/810#issuecomment-602770714) from @asottile to be very helpful.
137136
138-
#### git workflow
137+
### git Workflow
139138

140139
0. :warning: First, ensure that, before you make any changes, you have pulled the latest changes from remote.
141140
1. Add the file(s) you wanna commit: `git add whatever`
142141
2. `git commit` -- this will run [Commitizen](http://commitizen.github.io/cz-cli/); you'll be prompted to fill in any required fields and your commit messages will be formatted according to [cz-conventional-changelog](https://github.com/commitizen/cz-conventional-changelog) &ndash; a Commitizen adapter which prompts for [conventional changelog](https://github.com/conventional-changelog/conventional-changelog) standard.
143142
3. If there are no issues, push your changes accordingly, otherwise, repeat steps 1 and 2 above until all issues are resolved.
144143

145-
> :exclamation: If you encounter `stylelint` errors, you might wanna run `npm run css-fix` to try and fix such errors. This is likely to happen on first commit!
144+
> :exclamation: If you encounter `stylelint` errors, you might wanna run `yarn css-fix` to try and fix such errors. This is likely to happen on first commit!
146145
147-
> :exclamation: If you make any changes to the structure of your README.md or other markdown files, do `npm run toc` before committing, so that the TOC is updated
146+
> :exclamation: If you make any changes to the structure of your README.md or other markdown files, do `yarn toc` before committing, so that the TOC is updated
148147
149-
#### Python Code Formatting
148+
### Python Code Formatting
150149

151150
- Run `invoke lint` to run [`flake8`](https://flake8.pycqa.org/en/latest/), [`black`](https://black.readthedocs.io/en/stable/), [`isort`](https://pycqa.github.io/isort/) on the code.
152151
- If you get any errors from `black` and/or `isort`, run `invoke lint --fix` or `invoke lint -f` so that black and isort can format your files. If this still doesn't work, don't worry, there's a bunch of pre-commit hooks that that have been set up to deal with this. Take a look at [.pre-commit-config.yaml](.pre-commit-config.yaml).
153152

154-
## :+1: Credits
155-
156-
- `.gitignore` generated using <https://www.gitignore.io/>
157-
- favicon created using <http://realfavicongenerator.net/>
158-
- Images courtesy of [Unsplash](https://unsplash.com/) and [Pixabay](https://pixabay.com/)
159-
- Placeholder logo courtesy of <https://github.com/pigment/fake-logos>
160-
- <https://loremipsum.io/> for placeholder text
161-
- HTML template based on <https://startbootstrap.com/templates/business-frontpage/>
162-
- _Team_ Section on **About** Page based on <https://startbootstrap.com/snippets/about-team/>
163-
- ... I'll keep updating this ...
164-
165-
## ✍️ To do
153+
## TODO ✅
166154

167155
### Automation
168156

@@ -194,14 +182,40 @@ Simply choose one of the three and delete the others. If you don't like any of t
194182
- [X] Write tests and setup CI for this cookiecutter package
195183
- [X] Possibly add support for other popular CI options (added CircleCI and GitHub Actions)
196184
- [X] Add `Gulp` support (No longer using `Grunt`)
197-
- [X] Add better production-level features to make it easy to move from development to production (serving static assets, mail, caching, perfomance, task queues, Nginx and uWsgi/Gunicorn configuration, etc.) (*This is always a work in progress, will continue updating as necessary*)
185+
- [X] Add better production-level features to make it easy to move from development to production (serving static assets, mail, caching, performance, task queues, Nginx and uWsgi/Gunicorn configuration, etc.) (*This is always a work in progress, will continue updating as necessary*)
198186

199187
### Deprecated
200188

201189
- [X] ~~Add support for different Databases right from the beginning~~. Even though this cookiecuter generates an SQLite `DATABASE_URL` for you, some of the generated project's features (like **search**) depend on using Postgres, so you should use Postgres/PostGIS.
202190
- [X] ~~The cookiecutter prompt asks if you wanna use bootswatch themes. If you say "n", it shouldn't prompt you with another question on which bootswatch theme to use! See [this](https://github.com/polyswarm/participant-template/issues/2) and [that](https://github.com/cookiecutter/cookiecutter/issues/913)~~. Since we're customizing bootstrap using Sass, no need to use bootswatch.
203191

204-
## 📋 Reference
192+
## Contributing 🤝
193+
194+
Contributions, issues and feature requests are most welcome! A good place to start is by helping out with the unchecked items in the [TODO](#todo-) section above!
195+
196+
Feel free to check the [issues page](https://github.com/engineervix/cookiecutter-wagtail-vix/issues) and take a look at the [contributing guide](https://github.com/engineervix/cookiecutter-wagtail-vix/blob/master/CONTRIBUTING.md) before you get started. In addition, please note the following:
197+
198+
- if you're making code contributions, please try and write some tests to accompany your code, and ensure that the tests pass. Also, where necessary, update the docs so that they reflect your changes.
199+
- commit your changes via `cz commit`. Follow the prompts. When you're done, `pre-commit` will be invoked to ensure that your contributions and commits follow defined conventions. See `pre-commit-config.yaml` for more details.
200+
- your commit messages should follow the conventions described [here](https://www.conventionalcommits.org/en/v1.0.0/). Write your commit message in the imperative: "Fix bug" and not "Fixed bug" or "Fixes bug." This convention matches up with commit messages generated by commands like `git merge` and `git revert`.
201+
Once you are done, please create a [pull request](https://github.com/engineervix/cookiecutter-wagtail-vix/pulls).
202+
203+
## Show your support
204+
205+
Please give a ⭐️ if this project helped you!
206+
207+
## Credits 👏
208+
209+
- `.gitignore` generated using <https://www.gitignore.io/>
210+
- favicon created using <http://realfavicongenerator.net/>
211+
- Images courtesy of [Unsplash](https://unsplash.com/) and [Pixabay](https://pixabay.com/)
212+
- Placeholder logo courtesy of <https://github.com/pigment/fake-logos>
213+
- <https://loremipsum.io/> for placeholder text
214+
- HTML template based on <https://startbootstrap.com/templates/business-frontpage/>
215+
- _Team_ Section on **About** Page based on <https://startbootstrap.com/snippets/about-team/>
216+
217+
218+
## Reference 📋
205219

206220
The data was dumped as follows:
207221

@@ -210,5 +224,20 @@ The data was dumped as follows:
210224
-e contenttypes -e auth \
211225
-e wagtailcore.groupcollectionpermission \
212226
-e wagtailcore.grouppagepermission -e wagtailimages.rendition \
227+
-e postgres_search.indexentry -e users.user \
213228
-e sessions > data.json
214229
```
230+
231+
## Author
232+
233+
👤 **Victor Miti**
234+
235+
- Blog: <https://importthis.tech>
236+
- Twitter: [![Twitter: engineervix](https://img.shields.io/twitter/follow/engineervix.svg?style=social)](https://twitter.com/engineervix)
237+
- Github: [@engineervix](https://github.com/engineervix)
238+
239+
## License 📝
240+
241+
Copyright © 2021 [Victor Miti](https://github.com/engineervix).
242+
243+
This project is licensed under the terms of the [MIT](https://github.com/engineervix/engineervix/blob/master/LICENSE) license.

docs/img/homepage_screenshot.png

76.4 KB
Loading

0 commit comments

Comments
 (0)