Python WSGI

Instructions for installing Archetype's Python SDK with WSGI Backends

What is Archetype

Archetype is a powerful, reliable purchase server with cross-platform support. Our open-source framework provides a backend and a wrapper around Stripe to make implementing API keys and creating quotas and subscriptions easy.


Python WSGI Backends:

  • Django
  • Flask
  • Bottle
    This will not for work for ASGI Services like Quart

Step 1: Install and Import Archetype

First install the package with PIP

pip install archetypewsgi

or add below line to the end of your requirements.txt

from archetype import ArchetypeClient
from archetype import ArchetypeWSGI

# Flask constructor takes the name of
# current module (__name__) as argument.
app = Flask(__name__)

### Implement Archetype here
settings = {
    "app_id": "55431ab069594edea85828e25f03e7c0",  ## YOUR App_ID. Can be found in the page.
    "secret_key": "487c183adc084d3cb8247b17d951ed83",  ## YOUR Secret Key. Can be found in the page
archetype = ArchetypeClient(settings)
app.wsgi_app = ArchetypeWSGI(app.wsgi_app, settings=settings)

Step 2: Set up Archetype

Initialize your codebase with Archetype

Once you've installed the package you can modify your or initialization of your WSGI app from this.

from flask import Flask

app  =  Flask(__name__,  static_folder="web/build",  static_url_path="/")

Now you need to import and actually integrate Archetype into your initialization step.

Archetype will be created as a Middleware service that lives asynchronously to your main function run so it's non-blocking.

from flask import Flask
from Archetype import Archetype, ArchetypeWSGI

Now that you've finished installing Archetype, head on over to the Configuring SDK pages to learn the next steps on basic usage!

What’s Next

Once you've done this you can customize your SDK usage and create endpoints that register new users, return their details and more!