Skip to main content

sanic-conf

Django-like settings for Sanic

PyPI Build Status

Quick Start

Installation

pip install sanic-conf

Create settings.py file

sanic
├─ app.py
└─ settings.py

Fill out the project settings

# settings.py

PROXIES_COUNT = 1
REAL_IP_HEADER = 'X-Real-IP'

Apply to Sanic config

import os
from sanic import Sanic
from sanic_conf import settings

app = Sanic(__name__, load_env=False)

# settings
os.environ.setdefault('SANIC_SETTINGS_MODULE', 'settings')
app.config.update_config(settings)

Environment variables

Note that you can use django-environ with Sanic.

pip install django-environ
# settings.py

import environ
env = environ.Env(
    DEBUG=(bool, False)
)

# reading .env file
environ.Env.read_env()

# False if not in os.environ
DEBUG = env('DEBUG')

PROXIES_COUNT = 1
REAL_IP_HEADER = 'X-Real-IP'

Metadata

Release files for sanic-conf 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sanic-conf 0.0.7
File Size Uploaded
sanic-conf-0.0.7.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sanic-conf 0.0.7
File Interpreter ABI Platform
sanic_conf-0.0.7-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 7.3 kB

Release files / sanic-conf-0.0.7.tar.gz

Download URL sanic-conf-0.0.7.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
12a17a004681326b50434cba7b5534a6fc9db0625e617882a7bb368f3c0831c9
BLAKE2b-256 checksum
How to use checksums
be5493a7e43767db790de3d797d3d112c62782f2501259952a8e8f6782d45452
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.0

Release files / sanic_conf-0.0.7-py2.py3-none-any.whl

Download URL sanic_conf-0.0.7-py2.py3-none-any.whl
Size 3.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ac8e2512a63ebb5740d0733459ce020c59cea8b9c9799e3c3ce95cff11c4e9b4
BLAKE2b-256 checksum
How to use checksums
347ffed1da947c3d628033cce6c0c1c6450804204b97d21b034733bb8f1900ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.0

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page