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
0
votes
1 answer

django shell_plus timeit call_command?

I've written a django command and want to see it's timing so inside django shell_plus I do this: import timeit from django.core.management import call_command timeit.timeit("""call_command('prova')""", number=3 ) The command should run 3 times and…
user2239318
  • 2,578
  • 7
  • 28
  • 50
0
votes
0 answers

Exclude Django Installed Apps while execute custom django command

I have "xxx" in installed apps (settings.INSTALLED_APPS) Inside this applications, I check on existing schema in Postgresql If schema not exists I throw the exception. I request a user to execute Django custom command (for create schema) python…
madjardi
  • 5,649
  • 2
  • 37
  • 37
0
votes
1 answer

Creation of a django model instance not working on a custom management command

I'm trying to create a new instance of one of my Django models. When I do it in my python shell it works fine and the object is indeed created. However, when I do it in one of my custom management commands' script using the exact same code, there is…
apple_pie
  • 329
  • 2
  • 13
0
votes
1 answer

Modifying Django Command argument

Lets say i have a command like: class Command(object): help = 'roll over and die' def add_arguments(self, parser): parser.add_argument( '--foo', help='see command help', …
Kazz
  • 585
  • 1
  • 6
  • 23
0
votes
1 answer

Dumping database & migrate to new DB using django management command

class Command(BaseCommand): args = 'Arguments is not needed' help = 'Django admin custom command poc.' def handle(self, *args, **options): db_alias = options.get('olddb') db_entry = settings.DATABASES.get(db_alias) …
danny
  • 11
  • 2
0
votes
1 answer

Django: automatically delete records

I am trying to delete records in real time or automatically similar to this As i have understand (I am a newbie) you need write a management command but I am having a hard time grasping the concept and how can it be in real time? Can someone point…
Juan Carlos Asuncion
  • 927
  • 2
  • 10
  • 26
0
votes
1 answer

Django commands cron ImportError: cannot import name

I want to add the models to the commands. /home/max/askmoiseev/ask/management/commands/cron.py # -*- coding: utf-8 -*- from django.core.management.base import BaseCommand, CommandError from ask.models import Tag class Command(BaseCommand): …
russianstudent
  • 129
  • 2
  • 12
0
votes
1 answer

django directory structure of module for commands

in django 1.6, I have a commands for make analysis over the database, with a set of functions. ├── management │   ├── __init__.py │   └── commands │   ├── __init__.py │   ├── analysis.py I like break the analysis.py in a set of files (maybe…
JuanPablo
  • 23,792
  • 39
  • 118
  • 164
0
votes
2 answers

Simple way to send emails asynchronously

I'm running a django app and when some event occurs I'd like to send email to a list of recipients. I know that using Celery would be an intelligent choice, but I'd like to know if there's another, most simple way to do it without having to install…
Rod0n
  • 1,019
  • 2
  • 14
  • 33
0
votes
1 answer

Implement synchronization logic in django application?

In my app I need a module that will synchronize database periodically (eg. every 24h) trough xml on remote server. What is the best option to do so - should I write separate app or create custom django command?
pixel
  • 24,905
  • 36
  • 149
  • 251
0
votes
0 answers

Can I invoke a django view using management command?

I have a view that I want to call using a management command, is this even possible ? I read through the django help, but I was not super clear on this aspect. I am currently running it on a development REST server.My views just send out an email,…
user1524625
  • 271
  • 1
  • 7
  • 19
0
votes
1 answer

django custom commands: how to use reduce repeated code

One of the best features of Django is the MVC way of thinking. I've tried to embrace this as a non-professional programmer. From recommendations on this site, I've been encouraged to start using django custom commands, even for some scripts that…
John
  • 1,263
  • 2
  • 15
  • 26
0
votes
1 answer

Django-dilla "Unknown command: 'dilla'"

I'm unable to make django-dilla work with my django1.4 project. I've installed django-dilla through pip and I can import it properly from shell. >>import…
misterte
  • 977
  • 1
  • 11
  • 21
0
votes
0 answers

django call_command returns no module named new_text

I have to create a django command which needs to call another django command, so I had to use call_command which seems to be cool and simple: call_command('command_to_call', new_text='arghslkjt') The command command_to_call is supposed to store…
smarber
  • 4,829
  • 7
  • 37
  • 78
0
votes
2 answers

How can I flatten an optparse structure?

I'm trying to build a management command for Django and I've run into an issue. It seems that the option_list variable needs to be a flattened list of options. Here's the code — edited for brevity — that's executed: def add_options(self, parser): …
Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382