Skip to main content

CLI for creating and managing Django projects

Project description

django-clite

A CLI tool that handles creating and managing Django projects

publish PyPI - Package PyPI - Python PyPI - License PyPI - Downloads

Installation

Install via pip:

pip install django-clite

After installation, the CLI will expose the binary with the name:

django-clite

Extending the CLI

Currently, there are two main ways of extending the functionality of the CLI:

  1. Adding your own commands/plugins
  2. Overriding the provided resource templates

Including your own commands

If you would like to extend the functionality of this CLI, you can include your own plugins/commands by setting an environment variable: DJANGO_CLITE_PLUGINS. Simply set this variable to the path where your plugins are.

Plugin commands are auto-discovered if they are placed under the plugins directory, but please be sure to do the following for this to work:

  1. Name your package and click command the same. That is, a package called get, for example, should define a get command.
  2. Place the command definition within the package's main.py module. For example:
# get/main.py
import click


@click.command()
@click.pass_context
def get(ctx):
    pass
  1. Sub-commands should be added to the top-most command group in the package's main.py module.
# get/main.py
import click


@click.group() # <- group
@click.pass_context
def get(ctx):
  pass


@click.command()
@click.pass_context
def foo(ctx):
  pass


get.add_command(foo)
  1. Access your commands via your top-most command group.
django-clite get foo

NOTE: If you would like to skip a plugin/command from being auto-discovered, simply rename the package by either prepending or appending any number of underscores (_). Any code contained within the package will be ignored.

Overriding the templates

The flag --templates-dir can be used to configure an additional path wherein the CLI can look for resource templates. Alternatively, you can use the environment variable DJANGO_CLITE_TEMPLATES_DIR for the same purpose.

Take a look at the template files directory for a reference of what files can be overriden. The paths of the templates you wish to override need to match the provided template. For example, if you wish to override the model template, which is defined under src/cli/template_files/models/model.tpl, you should define your own model template under your desired directory, i.e /path/to/templates/models/model.tpl.

Development

Install from source:

git clone https://github.com/oleoneto/django-clite.git
cd django-clite
pip install --editable .

Dependencies

Check out pyproject.toml for all installation dependencies.

Interactive Docs

In order to maintain consistency in our documentation of all the different commands and features of the CLI, we've decided to move the README to a series of Jupyter notebooks which you can explore per command under the docs directory.

To Do

Check out our open issues.

Pull requests

Found a bug? See a typo? Have an idea for new command? Feel free to submit a pull request with your contributions. They are much welcome and appreciated.

LICENSE

django-clite is BSD Licensed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_clite-0.19.1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_clite-0.19.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file django_clite-0.19.1.tar.gz.

File metadata

  • Download URL: django_clite-0.19.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for django_clite-0.19.1.tar.gz
Algorithm Hash digest
SHA256 ab57e6e9773bb6bd5ba21076b71e9368b490f637588c835804cd08f33ce95c93
MD5 fb70b1933252ef1b29b01bd0f61afe79
BLAKE2b-256 ca4c90080b438a842fc4d7e48bb7820fc1b0cbf296168b570776ea476b2c8c78

See more details on using hashes here.

File details

Details for the file django_clite-0.19.1-py3-none-any.whl.

File metadata

  • Download URL: django_clite-0.19.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for django_clite-0.19.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8f8b2cb1ab220d50d1c8067b229a84131c827a30abbe9e54efe5882eeaeb9006
MD5 6bad2239bc6fb0a32a7700b6345046bf
BLAKE2b-256 53f912b94a0d645a0b7c70a9c5b7d84dfa0d3cbec2eb57f8256a8176dce7cf5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page