semvec/pypi-packages huggingface dataset:
django-single-instance-model 1.0.6
Always have exactly one instance of a model.
License: MIT

# Single Instance Model

## Why?

We use Django for a lot of different things including CMS-style projects. In a CMS-style project, **the user often needs to be able to just modify some data that shows up on the site**. Maybe it's the content of a page.

![](demo/demo.gif)

The concept is simple: __There's always going to be exactly one instance of this model.__


## Installation

To install, `pip install django-single-instance-model`.


## Usage

In `models.py`:

```python
from django.db import models
from single_instance_model.models import SingleInstanceModel


class AboutUs(models.Model, SingleInstanceModel):
    text = models.TextField(max_length=2000)
```

In `admin.py`:

```python
from django.contrib import admin
from single_instance_model.admin import SingleInstanceModelAdmin
from . import models


@admin.register(models.AboutUs)
class AboutUsAdmin(SingleInstanceModelAdmin):
    pass
```


## Warning

This works by executing code **every time a database connection is established**.  It's a simple check to create the instance of the model if it doesn't exist.. but just be aware.
stripe-asgi-server 0.0.2
An asgi server for stripe payments
License: MIT

# ASGI Server for servers-side Stripe PaymentIntents API

In order to run this server, you need to set the environnement variable `STRIPE_KEY` set with your private stripe token:

```console
export STRIPE_KEY=sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

Running the server:

```console
gunicorn server:app -w 4 -k uvicorn.workers.UvicornWorker
```

Alternatively, while you're still in development you can simply run:

```console
python server/server.py
```

Which will enable auto-reload of your application every time a local change is detected.

## What is this server for?

When working with Stripe you need to perform some actions secretly (using your secret API token), in order to
keep these secret some requests to the Stripe API will be done on the server-side of your application. This is
where this service comes in.

The `stripe-asgi-server` is a minimal working server that will perform all secret actions
using the [`async-stripe`][async-stripe] module, for all the outgoing requests.

[async-stripe]: https://github.com/cglacet/async-stripe