Skip to content

A template for a Wagtail project with basic apps and a Webpack setup allowing developers to use React.

License

Notifications You must be signed in to change notification settings

raq929/wagtail-project-template

Repository files navigation

Wagtail Project Template

A template for a Wagtail project with basic apps and a Webpack setup.

Table of Contents

Requirements

Create a new repo from this template.

  1. Clone this repo
  2. Create a new virtualenv for your project and run pip install django
  3. Create a new project from the template by running django-admin startproject <project_name> --template=wagtail-project-template
  4. cd into your new project directory and run git init to initialize a git repository. Make an initial commit.
  5. Open your new project in a text editor and replace all instances of project_name with your project name.
  6. Change this README to be relevant to your project.
  7. Create a database using the instructions below.

Development

Quick start

  1. Create a virtualenv for this project (using python3)
  2. pip install -r dev-requirements.txt
  3. In a new window npm install then npm start
  4. Start postgresql
  5. createdb <project_name>
  6. DATABASE_URL=postgres:///iai ./manage.py migrate
  7. DATABASE_URL=postgres:///iai ./manage.py createdevdata
  8. DATABASE_URL=postgres:///iai ./manage.py runserver

Requirements

Use pipenv to manage requirements.

  1. pipenv install --three # Creates a virtualenv with python3 and installs normal dependencies
  2. pipenv install --dev # Installs dev dependencies
  3. pipenv install <package> # Installs the package and automatically updates Pipfile and Pipfile.lock.

Database configuration

The first time you run, you'll need to run migrations and create a superuser:

    python manage.py migrate           # Create/sync the database.
    python manage.py createsuperuser   # Create an initial user.

base.py will use sqlite3 by default. You can use postgres with the DATABASE_URL environment variable.

    createdb project_name
    DATABASE_URL=postgres:///project_name python manage.py migrate

The format for DATABASE_URL urls is <type_of_database>://<database_user>:<database_password>@<server>:<port>/<database_name> If no database is specified, the default is a SQLite database.

You can now run the server: DATABASE_URL=postgres:///project_name ./manage.py runserver

Management commands

createdevdata [--delete]
This command creates a basic Wagtail site and a superuser. It calls all other management commands related to development data. The delete flag deletes all data before creating new data.
createhomepage [--delete]
This command creates a homepage and Wagtail Site if they do not already exist. If called with the delete flag, deletes all pages except the root and creates a homepage. You will need to restart the server after running this command, as the Wagtail site number will change.
createblogposts
This command creates a blog index page (if it does not already exist) and the specified number of blog posts.

About

A template for a Wagtail project with basic apps and a Webpack setup allowing developers to use React.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published