django-sa
=============================
Utility to convert a python script into a standalone django script.
For Python2/Python3 and Django 1.7+
Installation
----------
Install::
pip install django-sa
Implementation Notes with Short Examples
----------
What happens when you try to run a script with django code in it?::
python backup.py
.. code-block:: python
Traceback (most recent call last):
File "backup.py", line 6, in <module>
↓
↓
↓
django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
django-sa way::
+ The script needs to be run from the project root directory
+ This uses the default django settings file which is in project_dir/settings.py
.. code-block:: python
from django_sa import setup_django
setup_django(__file__)
from community.models import Bot
bot = Bot.objects.get(pk=101)
bot.backup(async=True)
Using a different django settings file:
.. code-block:: python
from django_sa import setup_django
setup_django(__file__, 'my_project.settings.production')
from community.models import Bot
bot = Bot.objects.get(pk=101)
bot.backup(async=True)
* Version 0.1.
0.1 (2017-09-23)
++++++++++++++++++
* First release on PyPI.
Metadata
Release files for django-sa 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_sa-0.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for django_sa-0.1-py2.py3-none-any.whl |
Release files / django_sa-0.1-py2.py3-none-any.whl
| Download URL | django_sa-0.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
9478d1ee32db8f900b489af9f4117f5da563139c46c055f6af497d4508e66cf1
|
|
BLAKE2b-256 checksum How to use checksums |
0a293f3da4fe4346edcbeafe1ea6bd37bdf03beb91aa77b157fa03a3e20d7deb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-sa 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.