Questions tagged [django-commands]

django-commands refers to Django's django-admin.py and manage.py management commands used for common administrative tasks.

django-commands refers to Django's django-admin.py and manage.py management commands used for common administrative tasks.

See also:

77 questions
1
vote
2 answers

Visual Studio Code 'django-admin' command not recognized

'django-admin' is not recognized as an internal or external command, operable program or batch file... So I am getting this error in terminal. I am trying to build an app. First I opened a folder(page) in my computer D drive and then opened Visual…
Tech-D
  • 21
  • 2
  • 3
1
vote
1 answer

How to update existing data and create new one django base command?

i am trying to store data in from json file and i added its not a problem to add data but when i trigger data again again they copy data and create same new one that i don't want , i want that it will update existing data and if there will new data…
1
vote
1 answer

Asynchronous asyncio Django command runs sequentially

I have written a simple command to loop through all of Result objects and check its www field (representing URL of the published scientific result eg. https://doi.org/10.1109/5.771073) There is 1M results in our db and I want to check the www…
1
vote
0 answers

How to prevent django from running multiple instances of a command?

We have a custom command in a django app that performs synchronization of data with an external service. The command is started hourly. Usually, the command is finished within half an hour or less, but recently, we ran into a situation where the…
pusteblume
  • 101
  • 1
  • 8
1
vote
2 answers

My custom django-admin command won't call celery task

I am trying to write a custom django-admin command that executes a celery task, however the task doesn't execute and django just hangs when I try. from django.core.management.base import BaseCommand from myapp.tasks import my_celery_task class…
johnnythejames
  • 151
  • 2
  • 10
1
vote
2 answers

Testing Django commands file or stdin

I am writing a django command that takes a bunch of input and processes it. It seems natural that because of the volume of the data, the input should either come in as a file or as stdin. I would like to easily test it, and by easily, I mean,…
McKay
  • 12,334
  • 7
  • 53
  • 76
1
vote
2 answers

Run Django command from crontab, only one concurrently

I have a Django commend "script" that i running every 20 second like this:: (only shows part of it, and works fine ;)) * * * * * /manage.py btupdate * * * * * sleep 20; /manage.py btupdate * * * * * sleep 40; /manage.py btupdate My problem is that…
pkdkk
  • 3,905
  • 8
  • 44
  • 69
1
vote
1 answer

Can I combine custom django-admin commands?

I have several custom command classes that subclass BaseCommand. I use those in a specific order to populate the DB. I want to write another command to combine those in a single one. I don't want to write a shell script that will execute the…
LetsPlayYahtzee
  • 7,161
  • 12
  • 41
  • 65
1
vote
0 answers

Django: 'self' referencing and object inputs. Whats the difference?

Okay, so I am working on creating some commands in django, but I came across a intriguing issue with regards to my code here... from django.core.management.base import LabelCommand from optparse import make_option class Command(LabelCommand): …
1
vote
1 answer

Best way to schedule Django command that needs root access

I am using a Raspberry Pi as a (very simple) home weather station. I currently have a small python script that, when run, takes a temperature reading and posts the result as a new line to a Google Spreadsheet via the Google Docs API. This python…
8one6
  • 13,078
  • 12
  • 62
  • 84
1
vote
2 answers

Do I need close db connection in command [django]

According to this (http://djangosnippets.org/snippets/926/) snippet, connection closed in handle. But it is kind of old code. In django 1.4, Do we must close connection? I looked through django code but I cann't find code that closes connection. If…
Delgermurun
  • 648
  • 9
  • 19
0
votes
1 answer

Require Help Structuring Parallel HTTP Requests

Here's my case. I have three tables Book, Publisher and Price. I have a management command that does loops over each book and for each book, it queries the publisher to get the price which it then stores into the Prices table. It's a very simple…
Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382
0
votes
0 answers

Kafka and Django management command

Hello everyone hope I find you well! So I'm trying to setup a new project with Django and a Kafka consumer. I'm using confluent-python package to create my consumer. So I'm facing a very odd situation. When I start my project through my docker…
0
votes
0 answers

AP Scheduler skips logging of the job execution - How to resolve?

This is how my scheduler configuration and the registered job look like from django.core.management import call_command def start(): from django_apscheduler.jobstores import register_events, DjangoJobStore, register_job from…
0
votes
1 answer

How to combine multiple custom management commands in Django?

I wrote a set of commands for my Django project in the usual way. Is it possible to combine multiple commands into one command? class Command(BaseCommand): """ import all files in media in dir and add to db after call process to generate…
JasonTS
  • 2,479
  • 4
  • 32
  • 48