GithubHelp home page GithubHelp logo

jean-zombie / cookiecutter-django-wagtail Goto Github PK

View Code? Open in Web Editor NEW
67.0 3.0 13.0 5.65 MB

Cookiecutter Django + Wagtail

License: BSD 3-Clause "New" or "Revised" License

Python 65.29% Shell 8.02% Dockerfile 4.35% Makefile 0.55% Batchfile 0.51% JavaScript 4.22% CSS 1.59% HTML 14.92% SCSS 0.33% Procfile 0.21%
cookiecutter-template cookiecutter python python3 wagtail django docker

cookiecutter-django-wagtail's Introduction

Cookiecutter Django Wagtail

Build Status Documentation Status Code style: black

Powered by Cookiecutter, Cookiecutter-Django-Wagtail is a fork of the awesome Cookiecutter Django combined with Wagtail.

Features

  • For Django 4.1
  • Works with Python 3.10
  • Wagtail 4
  • Renders Django projects with 100% starting test coverage
  • Twitter Bootstrap v5
  • 12-Factor based settings via django-environ
  • Secure by default. We believe in SSL.
  • Optimized development and production settings
  • Registration via django-allauth
  • Comes with custom user model ready to go
  • Optional basic ASGI setup for Websockets
  • Optional custom static build using Gulp and livereload
  • Send emails via Anymail (using Mailgun by default or Amazon SES if AWS is selected cloud provider, but switchable)
  • Media storage using Amazon S3 or Google Cloud Storage
  • Docker support using docker-compose for development and production (using Traefik with LetsEncrypt support)
  • Procfile for deploying to Heroku
  • Instructions for deploying to PythonAnywhere
  • Run tests with unittest or pytest
  • Customizable PostgreSQL version
  • Default integration with pre-commit for identifying simple issues before submission to code review

Optional Integrations

These features can be enabled during initial project setup.

  • Serve static files from Amazon S3, Google Cloud Storage, Azure Storage or Whitenoise
  • Configuration for Celery and Flower (the latter in Docker setup only)
  • Integration with MailHog for local email testing
  • Integration with Sentry for error logging

Constraints

  • DRF as a setup option is removed for now, since the implementation of the OG Cookiecutter Django clashes with Wagtails API.
  • Only maintained 3rd party libraries are used.
  • Uses PostgreSQL everywhere: 10.19 - 14.1 (MySQL fork also available).
  • Environment variables for configuration (This won't work with Apache/mod_wsgi).

Support Cookiecutter Django!

The upstream of this repo, i.e. Cookiecutter Django, is run by volunteers. Please support them in their efforts to maintain and improve Cookiecutter Django:

  • Daniel Roy Greenfeld, Project Lead (GitHub, Patreon): expertise in Django and AWS ELB.
  • Nikita Shupeyko, Core Developer (GitHub): expertise in Python/Django, hands-on DevOps and frontend experience.

Usage

Instead of using Wagtail’s :code:start command you will use Cookiecutter to set up your project. Cookiecutter will prompt you for some technical and administrative question like your name, email, and various configuration issues.

First, get Cookiecutter:

$ pip install "cookiecutter>=2.1.1"

Now run it against this repo:

$ cookiecutter https://github.com/Jean-Zombie/cookiecutter-django-wagtail/

You'll be prompted for some values. Provide them, then a Django project will be created for you.

Answer the prompts with your own desired options. For example:

Cloning into 'cookiecutter-django'...
remote: Counting objects: 550, done.
remote: Compressing objects: 100% (310/310), done.
remote: Total 550 (delta 283), reused 479 (delta 222)
Receiving objects: 100% (550/550), 127.66 KiB | 58 KiB/s, done.
Resolving deltas: 100% (283/283), done.
project_name [My Awesome Project]: Reddit Clone
project_slug [reddit_clone]: reddit
description [Behold My Awesome Project!]: A reddit clone.
author_name [Daniel Roy Greenfeld]: Daniel Greenfeld
domain_name [example.com]: myreddit.com
email [[email protected]]: [email protected]
version [0.1.0]: 0.0.1
Select open_source_license:
1 - MIT
2 - BSD
3 - GPLv3
4 - Apache Software License 2.0
5 - Not open source
Choose from 1, 2, 3, 4, 5 [1]: 1
timezone [UTC]: America/Los_Angeles
windows [n]: n
use_pycharm [n]: y
use_docker [n]: n
Select postgresql_version:
1 - 14
2 - 13
3 - 12
4 - 11
5 - 10
Choose from 1, 2, 3, 4, 5 [1]: 1
Select cloud_provider:
1 - AWS
2 - GCP
3 - None
Choose from 1, 2, 3 [1]: 1
Select mail_service:
1 - Mailgun
2 - Amazon SES
3 - Mailjet
4 - Mandrill
5 - Postmark
6 - Sendgrid
7 - SendinBlue
8 - SparkPost
9 - Other SMTP
Choose from 1, 2, 3, 4, 5, 6, 7, 8, 9 [1]: 1
use_async [n]: n
Select frontend_pipeline:
1 - None
2 - Django Compressor
3 - Gulp
4 - Webpack
Choose from 1, 2, 3, 4 [1]: 1
use_celery [n]: y
use_mailhog [n]: n
use_sentry [n]: y
use_whitenoise [n]: n
use_heroku [n]: y
Select ci_tool:
1 - None
2 - Travis
3 - Gitlab
4 - Github
Choose from 1, 2, 3, 4 [1]: 4
keep_local_envs_in_vcs [y]: y
debug [n]: n

Enter the project and take a look around:

$ cd reddit/
$ ls

Create a git repo and push it there:

$ git init
$ git add .
$ git commit -m "first awesome commit"
$ git remote add origin [email protected]:pydanny/redditclone.git
$ git push -u origin master

Now take a look at your repo. Don't forget to carefully look at the generated README. Awesome, right?

For local development, see the following:

Community

  • Have questions? Before you ask questions anywhere else, please post your question on Stack Overflow under the cookiecutter-django tag. We check there periodically for questions.
  • If you think you found a bug or want to request a feature, please open an issue.
  • For anything else, you can chat with us on Discord.

For Readers of Two Scoops of Django

You may notice that some elements of this project do not exactly match what we describe in chapter 3. The reason for that is this project, amongst other things, serves as a test bed for trying out new ideas and concepts. Sometimes they work, sometimes they don't, but the end result is that it won't necessarily match precisely what is described in the book I co-authored.

For PyUp Users

If you are using PyUp to keep your dependencies updated and secure, use the code cookiecutter during checkout to get 15% off every month.

"Your Stuff"

Scattered throughout the Python and HTML of this project are places marked with "your stuff". This is where third-party libraries are to be integrated with your project.

For MySQL users

To get full MySQL support in addition to the default Postgresql, you can use this fork of the cookiecutter-django: https://github.com/mabdullahadeel/cookiecutter-django-mysql

Releases

Need a stable release? You can find them at https://github.com/cookiecutter/cookiecutter-django/releases

Not Exactly What You Want?

This is what I want. It might not be what you want. Don't worry, you have options:

Fork This

If you have differences in your preferred setup, I encourage you to fork this to create your own version. Once you have your fork working, let me know and I'll add it to a 'Similar Cookiecutter Templates' list here. It's up to you whether to rename your fork.

If you do rename your fork, I encourage you to submit it to the following places:

  • cookiecutter so it gets listed in the README as a template.
  • The cookiecutter grid on Django Packages.

Submit a Pull Request

We accept pull requests if they're small, atomic, and make our own project development experience better.

Articles

Have a blog or online publication? Write about your cookiecutter-django tips and tricks, then send us a pull request with the link.

cookiecutter-django-wagtail's People

Contributors

actions-user avatar afrowave avatar andrew-chen-wang avatar arnav13081994 avatar ashwoods avatar audreyfeldroy avatar bogdal avatar browniebroke avatar burhan avatar crdoconnor avatar danihodovic avatar demestav avatar dependabot[bot] avatar foarsitter avatar github-actions[bot] avatar hackebrot avatar jayfk avatar jean-zombie avatar kappataumu avatar luzfcb avatar noisy avatar pydanny avatar pyup-bot avatar sfdye avatar shireenrao avatar tanoabeleyra avatar theskumar avatar trungdong avatar webyneter avatar yunti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cookiecutter-django-wagtail's Issues

[Update Django] Django 3.2

3.2 requirements tables

base.txt

Name Version in Master 3.2 Compatible Version OK
pytz 2021.3 n/a
python-slugify 5.0.2 n/a
Pillow 8.4.0 n/a
rcssmin 1.0.6 n/a
argon2-cffi 21.1.0 n/a
whitenoise 5.3.0 6.0.0
redis 4.0.1 n/a
hiredis 2.0.0 n/a
celery 5.2.0 n/a
django-celery-beat 2.2.1
flower 1.0.0 n/a
uvicorn 0.15.0 n/a
django 3.1.13 n/a
django-environ 0.8.1
django-model-utils 4.2.0 4.2.0
django-allauth 0.46.0 0.48.0
django-crispy-forms 1.13.0 1.14.0
crispy-bootstrap5 0.6 0.6
django-compressor 2.4.1 3.1
django-redis 5.0.0 5.2.0
djangorestframework 3.12.4 3.13.1
django-cors-headers 3.10.0 3.11.0
wagtail 2.14.1 2.16.1

local.txt

Name Version in Master 3.2 Compatible Version OK
Werkzeug 2.0.2 n/a
ipdb 0.13.9 n/a
psycopg2 2.9.2 n/a
psycopg2-binary 2.9.2 n/a
watchgod 0.7 n/a
mypy 0.910 n/a
django-stubs 1.8.0 1.9.0
pytest 6.2.5 n/a
pytest-sugar 0.9.4 n/a
djangorestframework-stubs 1.4.0 n/a
sphinx 4.3.0 n/a
sphinx-autobuild 2021.3.14 n/a
flake8 4.0.1 n/a
flake8-isort 4.1.1 n/a
coverage 6.1.2 n/a
black 21.11b1 n/a
pylint-django 2.4.4
pylint-celery 0.3 n/a
pre-commit 2.15.0 n/a
factory-boy 3.2.1 3.2.1
django-debug-toolbar 3.2.2 3.2.4
django-extensions 3.1.5 3.1.5
django-coverage-plugin 2.0.2 2.0.2
pytest-django 4.4.0 4.5.2

production.txt

Name Version in Master 3.2 Compatible Version OK
gunicorn 20.1.0 n/a
psycopg2 2.9.2 n/a
Collectfast 2.2.0 n/a
sentry-sdk 1.5.0 n/a
hiredis 2.0.0 n/a
django-storages 1.12.3 1.12.3
django-anymail 8.4 8.5

django.urls.exceptions.NoReverseMatch whe first fire up

What happened?

When you first fire up the project, it gives you django.urls.exceptions.NoReverseMatch because index.html doesn't find the about route.

django.urls.exceptions.NoReverseMatch: Reverse for 'about' not found. 'about' is not a valid view function or pattern name.

What should've happened instead?

I have provided a quick solution in a pull request

Additional details

  • Host system configuration:
    • Version of cookiecutter CLI (get it with cookiecutter --version): 1.7.3

    • OS name and version: Ubuntu 20.04

    • Python version, run python3 -V:

    • Docker version (if using Docker), run docker --version: Docker version 20.10.11, build dea9396

    • docker-compose version (if using Docker), run docker-compose --version: docker-compose version 1.25.0, build unknown

    • ...

  • Options selected and/or replay file:
{
  "cookiecutter": {
    "project_name": "wagtail-cookie-test",
    "project_slug": "wagtail_cookie_test",
    "description": "uau project",
    "author_name": "deleyva",
    "domain_name": "example.com",
    "email": "[email protected]",
    "version": "0.1.0",
    "open_source_license": "MIT",
    "timezone": "Europe/Madrid",
    "windows": "n",
    "use_pycharm": "n",
    "use_docker": "y",
    "postgresql_version": "13.2",
    "js_task_runner": "None",
    "cloud_provider": "None",
    "mail_service": "Mailgun",
    "use_async": "n",
    "use_drf": "y",
    "custom_bootstrap_compilation": "n",
    "use_compressor": "n",
    "use_celery": "y",
    "use_mailhog": "y",
    "use_sentry": "y",
    "use_whitenoise": "y",
    "use_heroku": "n",
    "ci_tool": "None",
    "keep_local_envs_in_vcs": "y",
    "debug": "n",
    "_template": "[email protected]:Jean-Zombie/cookiecutter-django-wagtail.git"
  }
}

[Update Django] Django 4.0

4.0 requirements tables

base.txt

Name Version in Master 4.0 Compatible Version OK
pytz 2021.3 n/a
python-slugify 5.0.2 n/a
Pillow 8.4.0 n/a
rcssmin 1.0.6 n/a
argon2-cffi 21.1.0 n/a
whitenoise 5.3.0 6.0.0
redis 4.0.1 n/a
hiredis 2.0.0 n/a
celery 5.2.0 n/a
django-celery-beat 2.2.1
flower 1.0.0 n/a
uvicorn 0.15.0 n/a
django 3.1.13 n/a
django-environ 0.8.1
django-model-utils 4.2.0
django-allauth 0.46.0 0.48.0
django-crispy-forms 1.13.0 1.14.0
crispy-bootstrap5 0.6 0.6
django-compressor 2.4.1 3.1
django-redis 5.0.0 5.2.0
djangorestframework 3.12.4 3.13.1
django-cors-headers 3.10.0 3.11.0
wagtail 2.14.1 2.16.1

local.txt

Name Version in Master 4.0 Compatible Version OK
Werkzeug 2.0.2 n/a
ipdb 0.13.9 n/a
psycopg2 2.9.2 n/a
psycopg2-binary 2.9.2 n/a
watchgod 0.7 n/a
mypy 0.910 n/a
django-stubs 1.8.0
pytest 6.2.5 n/a
pytest-sugar 0.9.4 n/a
djangorestframework-stubs 1.4.0 n/a
sphinx 4.3.0 n/a
sphinx-autobuild 2021.3.14 n/a
flake8 4.0.1 n/a
flake8-isort 4.1.1 n/a
coverage 6.1.2 n/a
black 21.11b1 n/a
pylint-django 2.4.4
pylint-celery 0.3 n/a
pre-commit 2.15.0 n/a
factory-boy 3.2.1
django-debug-toolbar 3.2.2 3.2.4
django-extensions 3.1.5
django-coverage-plugin 2.0.2
pytest-django 4.4.0 4.5.2

production.txt

Name Version in Master 4.0 Compatible Version OK
gunicorn 20.1.0 n/a
psycopg2 2.9.2 n/a
Collectfast 2.2.0 n/a
sentry-sdk 1.5.0 n/a
hiredis 2.0.0 n/a
django-storages 1.12.3
django-anymail 8.4 8.5

Project with Docker stuck on "waiting for Postgres to become available"

What happened?

Used Cookiecutter, went through the set up, followed the instructions. Images and containers all built with no problems, but when trying to migrate the database or anything with Postgres, it just locks up the terminal by printing "Waiting for Postgres to become available" repeatedly.

What should've happened instead?

It should have connected and created the tables and migrations.

Additional details

I didn't make any changes to the project that the install instructions didn't instruct me to do.

  • Host system configuration:
    • Version of cookiecutter CLI (get it with cookiecutter --version): Cookiecutter 1.7.2
    • OS: WSL2 Ubuntu-20 distro on Windows 10
    • Python version: 3.9
    • Docker versions (if using Docker): Docker version 20.10.2, build 2291f61
    • ...
  • Options selected and/or replay file:
    "project_slug": "dj_grimmstar",
    "description": "Test env",
    "author_name": "Cyriina Grimm",
    "domain_name": "grimmstar.online",
    "email": "[email protected]",
    "version": "0.1.0",
    "open_source_license": "MIT",
    "timezone": "EST",
    "windows": "n",
    "use_pycharm": "n",
    "use_docker": "y",
    "postgresql_version": "12.3",
    "js_task_runner": "Gulp",
    "cloud_provider": "None",
    "mail_service": "Mailgun",
    "use_async": "n",
    "use_drf": "n",
    "custom_bootstrap_compilation": "n",
    "use_compressor": "n",
    "use_celery": "n",
    "use_mailhog": "n",
    "use_sentry": "n",
    "use_whitenoise": "y",
    "use_heroku": "n",
    "ci_tool": "Github",
    "keep_local_envs_in_vcs": "y",
    "debug": "y",
    "_template": "https://github.com/Jean-Zombie/cookiecutter-django-wagtail/"
    

2021-01-25
2021-01-25 (1)

Logs:
$ cookiecutter https://github.com/pydanny/cookiecutter-django
project_name [Project Name]: ...

Page object not initializing on Home Page template

Hello,

I've built the project, added a new field to the HomePage model, and added data via the admin panel.
However, when I'm trying to render {{page.body}} to the template, I get nothing. When I create a child page of the home page, it seems to work. But I need to be able to use all this for my home page. Not sure whats going on :(

models.py
`from wagtail.models import Page
from wagtail.fields import RichTextField
from wagtail.admin.panels import FieldPanel

class HomePage(Page):
body = RichTextField(blank=True)

content_panels = Page.content_panels + [
    FieldPanel('body'),
]`

templates/home/home_page.html

`{% extends "base.html" %}

{% load wagtailcore_tags %}

{% block body_class %}template-homepage{% endblock %}

{% block content %}

{{page.title}}
{{ page.body|richtext }}

{% endblock %}`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.