Metadata-Version: 2.0
Name: django-sa
Version: 0.1
Summary: Utility to convert a python script into a standalone django script
Home-page: https://github.com/kasun/django-sa
Author: Kasun Herath
Author-email: kasunh01@gmail.com
License: MIT
Keywords: django_sa,Django standalone
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Django
Classifier: Framework :: Django :: 1.7
Classifier: Framework :: Django :: 1.8
Classifier: Framework :: Django :: 1.9
Classifier: Framework :: Django :: 1.10
Classifier: Framework :: Django :: 1.11
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3

=============================
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.


