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
- Host: GitHub
- URL: https://github.com/lvleo21/django-custom-management-commands
- Owner: lvleo21
- Created: 2022-02-03T20:36:23.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-04T12:06:14.000Z (over 3 years ago)
- Last Synced: 2025-01-03T22:27:15.810Z (5 months ago)
- Topics: django
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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... 🚧