Subscription Website Builder’s Documentation

Subscription Website Builder (Subscribie) makes is easy for you to design and build a subscription based website. We’ve built all the complicated stuff for you.

A simple workflow:

  1. Customer chooses a package
  2. Customer enters contact info
  3. Take one-off/monthly payments (or both)

Quickstart: Run locally

git clone https://github.com/Subscribie/subscribie.git
cd subscribie
cp .env.example .env # Copy default .env settings (look at it)
virtualenv -p python3 venv # Create a python3.x virtualenv
. venv/bin/activate # Activate the virtualenv
pip install -r requirements.txt # Install requirements
export FLASK_APP=subscribie
export FLASK_DEBUG=1
flask initdb # (optional) initalize the database with dummy data
flask run # Run the app

Now visit http://127.0.0.1:5000

User’s Guide

Getting Started

Tasks

Install Subscribie CLI

The Subscribie command-line tool, allows you to run commands against a local subscribie site. It allows you to:

  • Initialise a new Subscribie project
  • Run a subscribie site locally
  • Change subscribie config settings
  • Create new themes using existing themes as a starting point

Before you begin

You must be using at least python version 3 and have the python package manager pip installed.

  • Python 3 or greater (Do python --version to find out your version)
  • Pip (python package installer)

Note

If you’re on a Mac, make sure python3 (or python3.6, or python3.7) is in your PATH. MacOS 10.14 and above defaults to zsh so you need to edit your ~/.zshrc file to ensure python 3 (or above) is in your path. For example, at the bottom of your ~/.zshrc file:

nano ~/.zshrc
# Add python 3.7 to PATH:
export PATH=$PATH:/Users/karabeen/Library/Python/3.7/bin

Change accordingly to the python version you have installed on your mac (you must have at least python version 3). For bash, edit your ~/.bashrc file with the same edit at the bottom.

Install Subscribie CLI

pip3.6 install --user subscribiecli

Verify subscribie cli installation

When you type subscribie in your terminal, you should see output similar to:

subscribie
Usage: subscribie [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  init       Initialise a new subscribie project
  initdb     Initialise the database
  migrate    Run latest migrations
  newtheme   Create new theme
  run        Run subscribie
  setconfig  Updates the config.py which is stored in instance/config.py...
Basic subscribie Commands:

The most useful two commands are:

  • subscribie --help (shows help menu)
  • subscribie --setconfig --help (for changing config)
Usage: subscribie [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  init       Initialise a new subscribie project
  initdb     Initialise the database
  migrate    Run latest migrations
  newtheme   Create new theme
  run        Run subscribie
  setconfig  Updates the config.py which is stored in instance/config.py...
Uninstall subscribie cli
# Uninstall
pip3.6 uninstall subscribiecli

What’s next

  • run-subscribie-website-locally

Create a Subscribie theme

How to create a frontend theme for Subscribie.

Before you begin

Make sure you have already:

Create a new theme using Subscribie cli

1. Go to your root subscribie folder
cd subscribie
2. Create a new theme, based on jesmond theme
subscribie newtheme --name mynewtheme --base jesmond

The subscribie newtheme command will take a copy of the latest jesmond theme (from github) and rename it to the name you gave.

Find your new theme in your themes directory. If you want to use another theme as a base, look at the themes already in the Subscribie github organisation: https://github.com/Subscribie?utf8=%E2%9C%93&q=theme-&type=&language=

3. Edit your .env file to the new theme name

Take out the existing theme name and src for jesmond, and replace it with your own, removing the src attribute. For example:

THEME_NAME=mytheme
4. Run your new theme

Run your subscribie site locally. During the output, you should see your theme name has changed to mynewtheme:

export FLASK_DEBUG=True
subscribie run
...
...
Theme name is: mytheme
...

Make some changes to your theme, and an reload. It will look exactly the same as jesmond to start with.

Create a Subscribie module

Name your module

Create a module named: module-<name-of-module> e.g. If your creating a module called “postage” name your module: “module-postage”.

Create the following file strucutre:

module-postage./
├── __init__.py
├── README.md
└── templates/

You will typically need at least the following imports in your __init__.py:

from flask import (Blueprint, render_template, abort, request, redirect)
from jinja2 import TemplateNotFound
from subscribie.db import get_jamla
from subscribie.auth import login_required

Declare module

In your __init__.py declare the module as a Flask blueprint (read about flask blueprints).

module_postage = Blueprint('iframe_postage', __name__, template_folder='templates')

Create an index page for your module (e.g. a settings page)

Every module should have an index page, this will appear on the shop admin dashboard allowing the user to configure and access your module if needed.

@module_postage.route('/module_postage/index') # Define a module index page
@module_postage.route('/show-module-postage-settings-index')
@login_required
def get_module_postage_index():
  """Index page for module_postage settings."""

  try:
    return render_template('module_postage_index.html', jamla=get_jamla())
  except TemplateNotFound:
    abort(404)

Subscribie

Subscribie is the main module. It performs the following actions:

  • Loads your theme
  • Loads any modules you have defined
  • Starts Flask on localhost, listening on port 5000 by default

Changing Configuration

By default you don’t need to change many of these options. Most of the options refer to:

  • Paths
  • Modules

To change settings use the subscribie command line utility.

  • View the setconfig help menu: subscribie --setconfig --help
  • View basic help menu: subscribie --help

Example:

subscribie setconfig --help

Usage: subscribie setconfig [OPTIONS]

  Updates the config.py which is stored in instance/config.py :param config:
  a dictionary

Options:
  --SECRET_KEY TEXT               Random key for flask                sessions
  --TEMPLATE_FOLDER TEXT          Path to theme                folder
  --STATIC_FOLDER TEXT            Path to static assets                folder
  --UPLOADED_IMAGES_DEST TEXT     Path to image               upload folder
  --DB_FULL_PATH TEXT             Path to database
  --SUCCESS_REDIRECT_URL TEXT     Mandate complete redirect url
  --THANKYOU_URL TEXT             Thank you url (journey complete url)
  --MAIL_SERVER TEXT              Mail server hostname or IP
  --MAIL_PORT INTEGER             Email submission port
  --MAIL_DEFAULT_SENDER TEXT      Default mailserver from
  --MAIL_USERNAME TEXT            Mailserver username
  --MAIL_PASSWORD TEXT            Mailserver password
  --MAIL_USE_TLS TEXT             Mailserver use TLS
  --EMAIL_LOGIN_FROM TEXT         Default email from
  --GOCARDLESS_CLIENT_ID TEXT     GoCardless client id               (not
                                  needed by default, unless doing a partner
                                  integration)
  --GOCARDLESS_CLIENT_SECRET TEXT
                                  GoCardless client                secret (not
                                  needed by default, unless doing partner
                                  integration
  --TEMPLATE_BASE_DIR TEXT        Set template base dir
  --help                          Show this message and exit.

Themes

Subscribie comes with an excellent default theme called Jesmond.

Getting Started

Jesmond

“jesmond” is the name of the default theme for subscription website builder. Jesmond is a sane default to get you up and selling quickly. Note the emphasis on selling. Don’t waste time reinventing patterns. This theme is a fast progessive web app (PWA) which means you get all the benefits of modern experiences usually only found on larger sites.

By default you have the jesmond theme installed, but of course you can create your own.

Static Assets

Static assets for a theme must be placed in the <theme-folder>/theme-<theme-name>/static folder.

Every theme is stored in it’s own folder named: theme-[theme-name]. For example, the jesmond theme is indside the :code`’themes/theme-jesmond` folder.

  • Static assets go in the folder below, in a folder called static.
  • Template code goes into the <theme-name> folder below theme-[theme-name]
themes
|
├── theme-jesmond
    |
    ├── jesmond
    └── static

Editing the theme

It is not recommended to edit the theme directly because your changes would be overwitten when you update to the latest Jesmond theme. See Create a Subscribie theme.