pax_global_header 0000666 0000000 0000000 00000000064 14626614773 0014532 g ustar 00root root 0000000 0000000 52 comment=4e9e80f8686a123e4199681792084ef48c0993c1
django-qr-code-4.1.0/ 0000775 0000000 0000000 00000000000 14626614773 0014326 5 ustar 00root root 0000000 0000000 django-qr-code-4.1.0/.editorconfig 0000664 0000000 0000000 00000000174 14626614773 0017005 0 ustar 00root root 0000000 0000000 root = true
[*]
indent_style = space
indent_size = 4
insert_final_newline = true
charset = utf-8
[*.html]
indent_size = 2
django-qr-code-4.1.0/.github/ 0000775 0000000 0000000 00000000000 14626614773 0015666 5 ustar 00root root 0000000 0000000 django-qr-code-4.1.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14626614773 0017723 5 ustar 00root root 0000000 0000000 django-qr-code-4.1.0/.github/workflows/ci.yml 0000664 0000000 0000000 00000000566 14626614773 0021050 0 ustar 00root root 0000000 0000000 name: Django QR Code Build and Test
on:
push:
branches:
- master
- features/**
- dependabot/**
pull_request:
branches:
- master
jobs:
docker:
timeout-minutes: 10
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run tests
run: |
cd scripts
./run-tests.sh
django-qr-code-4.1.0/.github/workflows/python-publish.yml 0000664 0000000 0000000 00000002074 14626614773 0023436 0 ustar 00root root 0000000 0000000 # This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package
on:
release:
types: [published]
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
django-qr-code-4.1.0/.gitignore 0000664 0000000 0000000 00000002571 14626614773 0016323 0 ustar 00root root 0000000 0000000 # Generated data and logs during tests.
tests_result/
tests_result.back/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
django-qr-code-4.1.0/CHANGELOG.md 0000664 0000000 0000000 00000023032 14626614773 0016137 0 ustar 00root root 0000000 0000000 # Change Log
## 4.1.0 (2024-06-01)
* Upgrade dependencies and drop support for Python < 3.10 and Pydantic <2.7.
* Add the capability to generate embedded Base64 SVG images as data URIs through template tags (in addition to the API capability introduced in version 4.0.1).
* Add support for alternative text customization (both template tags and API).
* Add support for CSS classes injection (both template tags and API).
* Reorganize and improve documentation.
## 4.0.1 (2024-01-04)
* Upgrade dependencies, and drop support for Pydantic <2.5, Django<4.2, Python 3.8
* Remove dependency to pytz.
* Add support for Python 3.12.
* Add support for Django 5.0.
* Introduce support for floating point size QR code modules.
* Introduce embedded Base64 SVG image as data URI.
* Behavior change: white background is no longer interpreted as transparent for SVG output (#41). If you want to avoid path fill of SVG to reduce the size of the SVG image, you have to explicitly set `light_color` to `None` in `QRCodeOptions`.
## 3.1.2 (2023-04-10)
* Fix bug in `WifiConfig` data class (#43).
* Fix typo in documentation (#45)
* Add support for Django 4.1 and Django 4.2.
* Add support for Python 3.11.
* Improved documentation.
## 3.1.1 (2022-07-28)
* Fix regression in demo site due to improper runtime type validation on `QRCodeOptions`.
* Minor improvements to documentation.
* Modernize code syntax for Python >= 3.7.
## 3.1.0 (2022-06-26)
* Add support for more properties for vCard: cellphone (TEL;TYPE=CELL), homephone (TEL;TYPE=HOME), workphone (TEL;TYPE=WORK)
* Add support for simple iCalendar event (VEVENT). (#38)
* Add support for Django 4.0.
* BREAKING CHANGES:
* Introduce type validation at runtime with pydantic. Existing code might need some type-related fixes.
* Drop support for Django 2.2.
## 3.0.0 (2021-11-27)
* Add support for European Payments Council Quick Response Code (EPC QR Code) version 002.
* Add support for vCard v3 QR code.
* Revamp support for MeCARD QR code to provide a cleaner API (old API remains available for compatibility).
* Introduce `qr_from_data` and `qr_url_from_data` to allow optimized encoding of alphanumeric, numeric, and byte data (adopt appropriate encoding mode depending on data content).
* Introduce support for `boost_error` flag.
* Introduce support for `encoding` parameter.
* Several breaking changes in API and generated QR codes:
* `text` parameters renamed to `data`;
* class methods `make_qr_text` renamed to `make_qr_data`;
* uses UTF-8 encoding by default for application and text QR codes (you must set the new `encoding` option or use the new `qr_from_data` and `qr_url_from_data` template tags to emulate old behavior);
* encoded geolocations always contain a decimal separator.
* Improve API documentation.
* Add support for Python 3.10
* Drop support for Python 3.6.
* Drop support for Django 3.1.
## 2.3.0 (2021-11-07)
* Add support for `ECI mode` to control bytes encoding.
* Fix handling of `micro` QR code option when using URLs to serve image via `{% qr_url_from_text %}`.
* Fix handling of `cache_enabled` option when using URLs to serve image via `{% qr_url_from_text %}`.
* Fix handling of `url_signature_enabled` option when using URLs to serve image via `{% qr_url_from_text %}`.
## 2.2.0 (2021-06-03)
* Change encoding from URL-safe Base64 to standard Base64 for `text` query argument (used for serving QR code images).
* Fix #31 by passing the border parameter for segno.QRCode.save.
* Ensure compatibility with Django 3.2.
* Drop support for Django 3.0.
## 2.1.0 (2021-01-23)
* Change encoding from URL-safe Base64 to standard Base64 for `text` query argument (used for serving QR code images).
* Introduce setting `SERVE_QR_CODE_IMAGE_PATH` to configure the path under which QR Code images are served.
* Reorganize and improve documentation.
* Fix #23
* Introduce usage of type hints.
## 2.0.1 (2020-11-24)
* Update the install_requires after the move from qrcode to Segno.
## 2.0.0 (2020-11-22)
* Remove dependency to Pillow / qrcode
* Switch to [Segno](https://pypi.org/project/segno/) for generating QR Codes
* Add support for QR Codes with multiple colors
* Add support for Micro QR Codes
* Stable SVG format for QR code between 32-bit and 64-bit architecture (#19)
* Use hyphens in URLs (#16)
* Add support for Python 3.9
## 1.3.1 (2020-09-07)
* Fix local testing script.
* Fix date of release 1.3.0 in readme.
* Code cleanup.
## 1.3.0 (2020-09-05)
* Drop support for Django 2.1.
* Ensure compatibility with Django 3.1.
## 1.2.0 (2020-04-26)
* Ensure compatibility with Django 3.0.
* Upgrade Pillow requirement to 7.1.
* Drop support for Python 3.5.
* Drop support for Django <2.2.
* More modern build environment and configuration for ReadTheDocs.
## 1.1.0 (2019-11-16)
* Ensure compatibility with Django 2.1.
* Ensure compatibility with Django 2.2.
* Upgrade qr_code library from 5.3 to 6.1 (several fixes).
* Drop support for Python 3.4.
* Fixed error when generating qr code from lazy text. (#1)
* Add support for customizing usage of URL signature token via template tags (allows to generate URLs for serving QR code images that do not include a signature token). (#4)
* The caching of QR codes images could allow to bypass checking the user when external access is active.
* Upgrade Pillow requirement to 6.2.0 (CVE-2019-16865).
* Adopt a dedicated logger, and move message "Pillow is not installed. No support available for PNG format." from info to debug. (#6)
## 1.0.0 (2018-03-23)
* BREAKING CHANGES:
* QR code options have been factorized and now use the `QRCodeOptions` class.
* The context for rendering a QR code encoding a Wi-Fi configuration uses the dedicated `WifiConfig` class.
* The context for rendering a QR code encoding a contact detail uses the dedicated `ContactDetail` class.
* `qr_for_contact` and `qr_url_for_contact` keyword arg has been renamed from `contact_dict` to `contact_detail`.
* `qr_for_wifi` and `qr_url_for_wifi` keyword arg has been renamed from `wifi_dict` to `wifi_config`.
* Reorganize code and split qr_code.py into several modules.
The changes mentioned above might break the compatibility with code using qr_code.py's API directly, but template tags are not impacted, except for `qr_for_contact`, `qr_url_for_contact`, `qr_for_wifi`, and `qr_url_for_wifi` if they were using a keyword argument.
* Other changes:
* Added support for `error_correction` parameter when generating a QR code.
* Added support for `coordinates` keyword argument to `qr_for_geolocation`, `qr_for_google_maps`, `qr_url_for_geolocation`, and `qr_url_for_google_maps`.
* Additions to documentation.
* Added ability to use a `QRCodeOptions` instance with `options` keyword argument in all tags.
* Bug fixes:
* Fixed non-closed
tag when generating embedded PNG image.
* Escape colon char (':') if it appears within a contact detail or a wifi configuration.
* Add a second terminal semi-colon at the end of the text representing a wifi configuration, as recommended in some sources.
## 0.4.1 (2018-03-10)
* Fixed unescaped chars when generating QR code for a contact.
* Simplify handling of default values for QR code options.
* Add documentation about what a QR code can encode.
## 0.4.0 (2018-03-09)
* Added support for multiple new tags:
* `qr_for_email` and `qr_url_for_email`
* `qr_for_tel` and `qr_url_for_tel`
* `qr_for_sms` and `qr_url_for_sms`
* `qr_for_geolocation` and `qr_url_for_geolocation`
* `qr_for_google_maps` and `qr_url_for_google_maps`
* `qr_for_youtube` and `qr_url_for_youtube`
* `qr_for_google_play` and `qr_url_for_google_play`
* `qr_for_contact` and `qr_url_for_contact`
* `qr_for_wifi` and `qr_url_for_wifi`
* Reformat documentation on the demo site for better readability.
* Drop support for Django <1.11.
## 0.3.3 (2017-08-16)
* Added `app_name` namespace to `qr_code.urls` (better compatibility with `include()` function provided with Django >= 1.9).
* Update documentation regarding the inclusion of `qr_code.urls` for distinct versions of Django.
* Minor improvements to the documentation.
## 0.3.2 (2017-08-13)
* Allows optional installation of Pillow (PNG format unavailable, fallback to SVG).
* Fixed caching of images (not working due protection against external queries).
* Fixed conditional view processing (HTTP 304) for rendered QR codes (not working due protection against external queries).
## 0.3.1 (2017-08-12)
* Added a mention about Pillow library requirement in documentation.
* Minor improvements to the documentation and the demo application.
## 0.3.0 (2017-08-12)
* Added new tag qr_url_from_text:
* Separate image from the page displaying the image
* Handle caching of images
* Conditional view processing (HTTP 304) for rendered QR codes
* Protection against external requests
* Settings to configure URLs accesses as a service for generating QR code images
* Add documentation for new features
* Add tests for new features
* Add examples to demo site
* More robust testing of make_embedded_qr_code's arguments.
* Improved documentation.
* Demo site is compatible with Django 1.8.
* Added support for Docker Compose for running the demo application and running the tests.
## 0.2.1 (2017-08-05)
* Added support for Django 1.8.
* Fixed version specifiers for Django requirement so that it wont force the installation of Django 1.11.
* Added badges for PyPi, Read the Docs and Travis CI to readme file.
* Several additions to the documentation.
## 0.2.0 (2017-08-04)
* Add support for PNG image format via an `img` tag.
* Add documentation for users and developers.
* Improve examples in demo app.
## 0.1.1 (2017-08-02)
First public release.
django-qr-code-4.1.0/Dockerfile 0000664 0000000 0000000 00000002106 14626614773 0016317 0 ustar 00root root 0000000 0000000 ARG PYTHON_VERSION
FROM python:${PYTHON_VERSION}
LABEL vendor="dProg - Philippe Docourt" maintainer="Philippe Docourt" description="Demo Site for Django QR code"
ENV PYTHONUNBUFFERED 1
# Avoid possible occurrences of UnicodeEncodeError when running on x86 architecture.
ENV PYTHONIOENCODING utf-8
# Set env variables used in this Dockerfile (add a unique prefix, such as )
# Directory in container for project source files.
ARG APP_BASE_DIR=/usr/src/app
# Declare a proper Django settings file.
ENV DJANGO_SETTINGS_MODULE=demo_site.settings
# Make app dir.
RUN mkdir -p "$APP_BASE_DIR"
WORKDIR "$APP_BASE_DIR"
# Install requirements (separate step for caching intermediate image).
COPY requirements.txt "$APP_BASE_DIR/"
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
COPY requirements-web-deployment.txt "$APP_BASE_DIR/"
RUN pip install -r requirements-web-deployment.txt
# Copy entrypoint script into the image.
COPY ./docker-entrypoint.sh /
# Invoke app's entrypoint via dumb-init so that sub-processes are handled properly.
CMD ["/docker-entrypoint.sh"]
django-qr-code-4.1.0/LICENSE 0000664 0000000 0000000 00000002771 14626614773 0015342 0 ustar 00root root 0000000 0000000 BSD 3-Clause License
Copyright (c) 2017-2021, dProg - Philippe Docourt
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
django-qr-code-4.1.0/MANIFEST.in 0000664 0000000 0000000 00000000067 14626614773 0016067 0 ustar 00root root 0000000 0000000 include README.md
include LICENSE
include CHANGELOG.md
django-qr-code-4.1.0/README.md 0000664 0000000 0000000 00000013664 14626614773 0015617 0 ustar 00root root 0000000 0000000 # Django QR Code
[](https://badge.fury.io/py/django-qr-code)
[](https://pypi.python.org/pypi/django-qr-code)
[](https://django-qr-code.readthedocs.io/latest/pages/README.html)
[](https://github.com/dprog-philippe-docourt/django-qr-code/actions)
[](https://codeclimate.com/github/dprog-philippe-docourt/django-qr-code/maintainability)
This is an application that provides tools for displaying QR codes on your [Django](https://www.djangoproject.com/) site.
This application depends on the [Segno QR Code generator](https://pypi.org/project/segno/) library.
This app makes no usage of the Django models and therefore do not use any database.
Only Python >= 3.10 is supported.
## Features
* Generate QR codes as embedded SVG or PNG images in HTML templates.
* Customize QR codes with various parameters (size, error correction, border, etc.).
* Generate URLs for QR code images.
* Support for specific application QR codes (e.g., contact info, Wi-Fi config).
* Cache QR code images for performance.
* Secure QR code image serving with URL protection and user authentication.
## Installation
### Binary Package from PyPi
In order to use this app in a Django project, the simplest way is to install it from [PyPi](https://pypi.python.org/pypi/django-qr-code):
```bash
pip install django-qr-code
```
### From the Source Code
In order to modify or test this app you may want to install it from the source code.
Clone the [GitHub repository](https://github.com/dprog-philippe-docourt/django-qr-code) and install dependencies:
```bash
git clone https://github.com/dprog-philippe-docourt/django-qr-code
pip install -r requirements.txt -r requirements-dev.txt
python manage.py collectstatic --no-input
```
## Usage
Start by adding `qr_code` to your `INSTALLED_APPS` setting like this:
```python
INSTALLED_APPS = (
# ...,
'qr_code',
)
```
You need to load the tags provided by this app in your template with:
```htmldjango
{% load qr_code %}
```
The source code on [GitHub](https://github.com/dprog-philippe-docourt/django-qr-code) contains a simple demo app. Please check out the [templates folder](https://github.com/dprog-philippe-docourt/django-qr-code/tree/master/qr_code_demo/templates/qr_code_demo) for an example of template, and the [setting](https://github.com/dprog-philippe-docourt/django-qr-code/tree/master/demo_site/settings.py) and [urls](https://github.com/dprog-philippe-docourt/django-qr-code/tree/master/demo_site/urls.py) files for an example of configuration and integration.
### Example: Inline QR Code
Generate a simple QR code:
```htmldjango
{% qr_from_text "Hello World!" size="T" %}
```
### Example: URL QR Code
Generate a URL for a QR code image:
```htmldjango
```
### Advanced Usage of Tags
Refer to the [official documentation for tags](https://django-qr-code.readthedocs.io/latest/pages/template-tags.html) for more detailed information and advanced usage examples.
### Demo Application
If you want to try this app, you may want to use the demo application shipped alongside the source code.
Get the source code from [GitHub](https://github.com/dprog-philippe-docourt/django-qr-code), follow the [installation instructions](#from-the-source-code) above, and run the `runserver` command of Django:
```bash
python manage.py runserver
```
The demo application should be running at .
If you have [Docker Compose](https://docs.docker.com/compose/) installed, you can simply run the following from a terminal (this will save you the burden of setting up a proper python environment):
```bash
cd scripts
./run-demo-app.sh
```
The demo application should be running at .
## Generating Image Object Representing a QR Code
If you do not want to use Django tags for rendering QR code in a template, you can simply use the API in your code. For instance, `qr_code.qrcode.maker.make_qr_code_image` will return bytes representing an image according to the image_format passed in the `qr_code_options` parameter.
Refer to the [official API documentation](https://django-qr-code.readthedocs.io/latest/pages/api.html) for more detailed information.
## Testing
Get the source code from [GitHub](https://github.com/dprog-philippe-docourt/django-qr-code), follow the [installation instructions](#from-the-source-code) above, and run the `test` command of Django:
```bash
python manage.py test
```
This will run the test suite with the locally installed version of Python and Django.
If you have [Docker Compose](https://docs.docker.com/compose/) installed, you can simply run the following from a terminal (this will save you the burden of setting up a proper python environment):
```bash
cd scripts
./run-tests.sh
```
This will run the test suite with all supported versions of Python and Django. The test results are stored within `tests_result` folder.
## Projects Using this App
This app is used in the following projects:
* [MyGym Web](https://mygym-web.ch/): a web platform for managing sports clubs. The QR codes are used for importing members' contact information in a phone book.
* [Gymna-Score](https://gymna-score.acjg.ch/): a web platform for entering scores during gymnastics competitions organized by the Association Cantonale Jurassienne de Gymnastique (ACJG). The QR codes are used to provide an easy way for the public to follow an ongoing competition. They are also used to authenticate judges that need to enter scores.
* [AC-Ju](https://www.ac-ju.ch/): a website that generates digital vouchers that can be redeemed at affiliate merchants.
django-qr-code-4.1.0/demo_site/ 0000775 0000000 0000000 00000000000 14626614773 0016276 5 ustar 00root root 0000000 0000000 django-qr-code-4.1.0/demo_site/__init__.py 0000664 0000000 0000000 00000000000 14626614773 0020375 0 ustar 00root root 0000000 0000000 django-qr-code-4.1.0/demo_site/settings.py 0000664 0000000 0000000 00000007674 14626614773 0020526 0 ustar 00root root 0000000 0000000 """
Django settings for qr_code_demo project.
Generated by 'django-admin startproject' using Django 2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
import django
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
from qr_code.qrcode import constants
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "8l4)()f1&tg*dtxh6whlew#k-d5&79npe#j_dg9l0b)m8^g#8u"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = ["django.contrib.auth", "django.contrib.contenttypes", "django.contrib.staticfiles", "qr_code", "qr_code_demo"]
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
ROOT_URLCONF = "demo_site.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]
WSGI_APPLICATION = "demo_site.wsgi.application"
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = "/static/"
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
# Caches.
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
},
"qr-code": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache", "LOCATION": "qr-code-cache", "TIMEOUT": 3600},
}
# Django QR Code specific options.
QR_CODE_CACHE_ALIAS = "qr-code"
QR_CODE_URL_PROTECTION = {
constants.TOKEN_LENGTH: 30, # Optional random token length for URL protection. Defaults to 20.
constants.SIGNING_KEY: "my-secret-signing-key", # Optional signing key for URL token. Uses SECRET_KEY if not defined.
constants.SIGNING_SALT: "my-signing-salt", # Optional signing salt for URL token.
constants.ALLOWS_EXTERNAL_REQUESTS_FOR_REGISTERED_USER: lambda u: True, # Tells whether a registered user can request the QR code URLs from outside a site that uses this app. It can be a boolean value used for any user, or a callable that takes a user as parameter. Defaults to False (nobody can access the URL without the security token).
}
SERVE_QR_CODE_IMAGE_PATH = "qr-code-image/"
django-qr-code-4.1.0/demo_site/urls.py 0000664 0000000 0000000 00000000543 14626614773 0017637 0 ustar 00root root 0000000 0000000 from django.conf.urls import include
from django.urls import path
from django.views.generic import RedirectView
urlpatterns = [
path("", RedirectView.as_view(url="qr-code-demo/", permanent=True)),
path("qr-code-demo/", include("qr_code_demo.urls", namespace="qr_code_demo")),
path("qr-code/", include("qr_code.urls", namespace="qr_code")),
]
django-qr-code-4.1.0/demo_site/wsgi.py 0000664 0000000 0000000 00000000622 14626614773 0017621 0 ustar 00root root 0000000 0000000 """
WSGI config for qr_code_demo project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "qr_code_demo.settings")
application = get_wsgi_application()
django-qr-code-4.1.0/docker-compose.yml 0000664 0000000 0000000 00000000417 14626614773 0017765 0 ustar 00root root 0000000 0000000 version: '3.7'
services:
django-qr-code:
build:
context: .
dockerfile: Dockerfile
args:
- PYTHON_VERSION
volumes:
- ./:/usr/src/app
environment:
- APP_PORT=8910
expose:
- "8910"
ports:
- "8910:8910"
django-qr-code-4.1.0/docker-entrypoint.sh 0000775 0000000 0000000 00000001061 14626614773 0020343 0 ustar 00root root 0000000 0000000 #!/bin/bash
echo APP_PORT=$APP_PORT
echo DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
# Collect static files first.
python3 manage.py collectstatic --noinput
echo --- Start Gunicorn processes and replace the shell [i.e. invoke gunicorn with exec]
echo Starting Gunicorn.
exec gunicorn demo_site.wsgi:application \
--name django-qr-code \
--bind 0.0.0.0:$APP_PORT \
--workers 2 \
--worker-class=gthread \
--log-level=info \
--log-file=- \
--access-logfile=- \
--env DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE \
"$@"
django-qr-code-4.1.0/docs/ 0000775 0000000 0000000 00000000000 14626614773 0015256 5 ustar 00root root 0000000 0000000 django-qr-code-4.1.0/docs/Makefile 0000664 0000000 0000000 00000001145 14626614773 0016717 0 ustar 00root root 0000000 0000000 # Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = DjangoQRcode
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
django-qr-code-4.1.0/docs/_static/ 0000775 0000000 0000000 00000000000 14626614773 0016704 5 ustar 00root root 0000000 0000000 django-qr-code-4.1.0/docs/_static/colors/ 0000775 0000000 0000000 00000000000 14626614773 0020205 5 ustar 00root root 0000000 0000000 django-qr-code-4.1.0/docs/_static/colors/alignment_dark.png 0000664 0000000 0000000 00000001225 14626614773 0023672 0 ustar 00root root 0000000 0000000 PNG
IHDR PLTE ,? GIDATxZY@sG]ҧy)[?C34R#/qYs~33>sYǮ7ahfc:xe3OUʺMC<\]C "nT] "\gˇZ!.C6Re^q0Ʌ][^5hMA5K9=m-@!2a "]Bud0*6k0tD "Qr4+Q.ie'ծe ?x\{?dˇՎ8[*Ү>:-5z.֫0xË|Rqt#fcCLʇaj(*a!\@}(