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

Quick Start

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

To use the Subfork Python API your site must have a verified domain. Then instantiate a client using the site domain and access keys:

import subfork
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 shared config file, copy the example_subfork.yml file to subfork.yml at the root of your project and make required updates:

$ cp example_subfork.yml subfork.yml
$ nano subfork.yml

Or set $SUBFORK_CONFIG_FILE to the path to subfork.yml:

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

An example subfork.yml config file contains the following:

# 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

Basic Commands

To create a site template file from existing template and static files folders:

$ subfork create -t templates -s static

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

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.7.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