An open API service indexing awesome lists of open source software.

https://github.com/lvleo21/django-custom-management-commands

Writing custom management commands in Django
https://github.com/lvleo21/django-custom-management-commands

django

Last synced: 3 months ago
JSON representation

Writing custom management commands in Django

Awesome Lists containing this project

README

        

Writing custom management commands in Django

This project example will show how to add data from file json in your database through a django custom management commands.

## Table of Contents

* [Running this project](#running-this-project)
* [Creating your custom command](#creating-your-custom-command)

## Running this project

1. Clone project in your machine
2. Create and active the virtualenv from this command

```bash
python3 -m venv venv
source venv/bin/activate
```

3. Install all required packages

```bash
pip install -r requirements.txt
```

4. Create a sqlite database

```bash
python manage.py migrate
```
5. Run the custom management command

```bash
python manage.py load_data peoples.json
```

## Creating your custom command

1. In your project app, create directory called **management** and a child directory called **commands**

2. Create a python file with the name “my_command.py” (choose the name according to what your command is going to do) inside the commands directory

3.


🚧 Readme in construction... 🚧