Skip to main content

Subfork Python API

Project description

Subfork Python API

Subfork is the easiest way to build and deploy static sites and micro web apps. This package provides the Subfork Python API and command line interface.

Installation

The easiest way to install:

$ pip install subfork

In order to authenticate with the Subfork API, you will first need to create a site and API access keys for your site at subfork.com.

Quick Start

To use the Subfork Python API you must first complete the configuration steps below. Then instantiate a client using the site domain and access keys:

sf = subfork.get_client()

Configuration

Using the Subfork Python API requires basic authentication. To use environment variables, set the following:

$ export SUBFORK_DOMAIN=<site domain>
$ export SUBFORK_ACCESS_KEY=<access key>
$ export SUBFORK_SECRET_KEY=<secret key>

To use a template file, create a subfork.yml at the root of your project and make required updates, or set $SUBFORK_CONFIG_FILE to the path to subfork.yml:

$ export SUBFORK_CONFIG_FILE=/path/to/subfork.yml

Basic Commands

To create a site template file from existing source files:

$ subfork create -t templates -s static

Be sure to update the values in the new subfork.yml if necessary.

To test the site using the dev server:

$ subfork run

To deploy and release a site:

$ subfork deploy -c "initial deployment" --release

To process queued tasks:

$ subfork worker

Templates

The subfork.yml template file is a config file that contains information about your site template files, routes and task workers, for example:

# enter verified site domain here
domain: example.fork.io

# enter site credentials here
# access_key: ${SUBFORK_ACCESS_KEY}
# secret_key: ${SUBFORK_SECRET_KEY}

# template and static file folder paths
# template_folder: templates
# static_folder: static

# page template definitions
templates:
  index:
    route: /
    file: index.html
  user:
    route: /user/<username>
    file: user.html

# task worker definitions
workers:
  test:
    queue: test
    function: subfork.worker.test

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

subfork-0.9.8.tar.gz (29.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page