Metadata-Version: 2.4
Name: django-cmd
Version: 2.7
Summary: Have a django command
Project-URL: homepage, https://github.com/ryanhiebert/django-cmd
Project-URL: repository, https://github.com/ryanhiebert/django-cmd
Author-email: Ryan Hiebert <ryan@ryanhiebert.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 3
Classifier: Framework :: Django :: 3.0
Classifier: Framework :: Django :: 3.1
Classifier: Framework :: Django :: 3.2
Classifier: Framework :: Django :: 4
Classifier: Framework :: Django :: 4.0
Classifier: Framework :: Django :: 4.1
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6
Classifier: Framework :: Django :: 6.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.8
Requires-Dist: django
Requires-Dist: tomli; python_version < '3.11'
Description-Content-Type: text/x-rst

=================================
django-cmd: Have a django command
=================================

.. image:: https://img.shields.io/pypi/v/django-cmd.svg
   :target: https://pypi.python.org/pypi/django-cmd
   :alt: Latest Version

.. image:: https://github.com/ryanhiebert/django-cmd/actions/workflows/build.yml/badge.svg
   :target: https://github.com/ryanhiebert/django-cmd/actions/workflows/build.yml

.. image:: https://codecov.io/gh/ryanhiebert/django-cmd/graph/badge.svg?token=OK3xJ71rjV
   :target: https://codecov.io/gh/ryanhiebert/django-cmd


Django includes the ``django-admin`` command.
They prefer to not include multiple ways to do the same thing,
but I really want to spell it ``django``.
I also wanted to be able to configure a
default settings module in a configuration file.


Usage
=====

.. code-block:: sh

    pip install django-cmd
    django startproject


Once installed, you can use the ``django`` command
the same as you would normally use the ``django-admin`` command.

Replace manage.py
=================

Did you know that the ``manage.py`` script is just
a thin wrapper around the ``django-admin`` command?
All the wrapper does is set ``DJANGO_SETTINGS_MODULE``
so that it can load your settings and find
any additional commands from your installed apps.
With a tiny bit of configuration,
you can use this ``django`` command in place of ``python manage.py``!

In your ``pyproject.toml`` file,
add a section like this to configure your default settings module:

.. code-block:: toml

    [tool.django]
    settings_module = "myproject.settings"

Or add a section like this to a ``setup.cfg`` file:

.. code-block:: ini

    [django]
    settings_module = myproject.settings

Now you can also use the ``django`` command
everywhere you would normally use ``python manage.py``:

.. code-block:: sh

    django runserver
    django migrate
    django createsuperuser
