Deploying and customizing datasette

Step by step follow-up on how I've deployed it and added custom templates on top.

First, create the venv and install everything

# Create and activate venv
python3 -m venv venv
source venv/bin/activate

# Install datasette…
pip install datasette

# … and the plugins
datasette install datasette-render-markdown datasette-dashboards datasette-dateutil

I was curious how much all of this was weighting. 30MB seems pretty reasonable to me.

# All of this weights 30Mb
du -sh venv
30M venv

Adding authentication

Datasette doesn’t provide authentication by default, so you have to use a plugin for this. I’ll be using Github authentication for now as it seems simple to add:

pip install datasette-auth-github

I’ve had to create a new github application and export the variables to my server, and add some configuration to my metadata.yaml file:

allow:
  gh_login: almet

plugins:
  datasette-auth-github:
    client_id:
      "$env": GITHUB_CLIENT_ID
    client_secret:
      "$env": GITHUB_CLIENT_SECRET

If that’s useful to you, here is the git repository I’m deploying to my server.

Using templates

Okay, I now want to be able to send my clients an URL on which they can see what I’ve been doing, and what I’ve been using my time on.

The documentation

#Datasette, #Deployment - Posté dans la catégorie code