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
0 answers

Passing value from Django custom command to a view

I want to pass value from django custom command to a view. Custom command: GDA_frontend/GDA_datatables/management/commands/gda_start.py class Command(BaseCommand): help = 'Starts the GDA app with API key for typesense search engine' def…
0
votes
1 answer

Scheduled Tasks - Runs without Error but does not produce any output - Django PythonAnywhere

I have setup a scheduled task to run daily on PythonAnywhere. The task uses the Django Commands as I found this was the preferred method to use with PythonAnywhere. The tasks produces no errors but I don't get any output. 2022-06-16 22:56:13 --…
0
votes
1 answer

Django how to not comment some lines with makemessages

Problem I translate my group names in my Django application with the default translation tools. Since my group names are not hard-coded in my code, when I run makemessages, the lines corresponding to my group names are commented out. Example I have…
Raida
  • 1,206
  • 5
  • 17
0
votes
1 answer

How to pass extra arguments to startapp command in bash?

I want to pass values to template_context and the docs says: Any option passed to the startapp command (among the command’s supported options) What I understand is, that any extra argument that I pass, it will be set to the context dictionary. But…
user8410236
0
votes
0 answers

How to send data to running django management command?

I have a custom django management command that is constantly running through the supervisor (keep alive) I need under certain circumstances (for example, a signal in the project, or a change in the database) the django management process reacted to…
0
votes
1 answer

How to execute django runserver and python script at the same time (on one line in cmd)

I have wrote a python script which automatically uploads files from a given folder to a django modell. I want this script running while django server is running. My script runs perfectly when I run it in pycharm console. I have tried a few command…
brdptr02
  • 31
  • 5
0
votes
2 answers

Heroku django.core.exceptions.ImproperlyConfigured: Set the SECRET_KEY environment variable

I am trying to run a django command on my heroku production server, but get the following error: Note: The same command works fine in my local dev environment. I took the following steps: ssh onto my django server: heroku ps:exec -a…
0
votes
0 answers

Deleting posts via Django command doesn't work

Deleting posts via Django command does not work. I do not know what to do, I am at a dead end. I hope you can help me... delnc.py File command class Command(BaseCommand): help = 'Командa для удаления всех постов из категории' …
0
votes
0 answers

CommandError in django while using call_command(startapp, app_name)

I want to create a Django app from user input. Here is my code. def createAppname(name): split_name = name.split(" ") s = "".join(i[0:] for i in split_name) return s def formFields(request): if request.method == 'POST': …
Rohit Hazare
  • 1
  • 1
  • 4
0
votes
1 answer

Django: Can I use a subprocess w/ docker-compose inside a custom command?

I created a custom command in django and I want to use a docker-compose command in it. I use a subprocess as follow: class Command(BaseCommand): def handle(self, *args, **options): data = open_file() os.environ['DATA'] = data …
Kimor
  • 532
  • 4
  • 17
0
votes
0 answers

Django command running a shell script

I have an app that deletes files that have been uploaded more than one month ago. from django.core.management.base import BaseCommand, CommandError from blacklist_app.models import EntradaHistorial from datetime import datetime, timedelta import…
Jorge
  • 333
  • 1
  • 5
  • 17
0
votes
0 answers

How to upload file to Django Server with management command?

I am writing a management command to upload a file to my server. I am able to upload the file to media properly when the file is in the project folder. But i couldn't manage to upload a file from outside the folder. Here is the version when the file…
Hskl
  • 21
  • 2
0
votes
1 answer

Python Django call_command permissions gunicorn+nginx

Problem Receive 502 bad gateway when i try to execute a django management command via gunicorn Logic Line I think the problem is about permissions, something like gunicorn is not able call the command. I say that because i can run it locally where i…
Marcos Mendes
  • 1,091
  • 1
  • 8
  • 15
0
votes
0 answers

Call Django command with phrase as argument

I'm trying to run the command zappa manage staging 'run_sql --sql \"show databases\"' But I get the following error: zappa manage staging 'run_sql --sql "show databases"' [START] RequestId: dd895134-dc62-41c3-987b-3ea550af1129 Version:…
Vadorequest
  • 16,593
  • 24
  • 118
  • 215
0
votes
1 answer

Trouble understanding how the Django save() handles *args

Was fighting yesterday with the issue of importing pics from URL to the Django model. Was able to come up with a working solution, but still don't know how this is works. How a save func knows what kind of *args it could process and in what order?…
edvard_munch
  • 266
  • 1
  • 5
  • 17