Sunday, November 26, 2017

Re: Run manage.py test app_name command from view



On Sun, Nov 26, 2017 at 11:03 AM, Joshua O. Morales <joshuao.moralesjm@gmail.com> wrote:
 What I would like to do is to execute the tests.py by clicking a certain button.  I am trying to run the tests.py via views.py, but it gives me a 400 Bad Request error. Is there any other solution?
Your help would be very much appreciated.
Here's a snippet of the code:
from django.core.management import call_command
def start(request):
call_command('test appname')
It should be:
call_command('test', 'appname')
Don't know why is your 400, how are you requesting your view? Also, note that you are not returning any HttpResponse nor redirect in the snippet (It will give you other error)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BFDnh%2BotG8uAGPzb57Pix_g%3DLManuNL9%3DFwg7ObacK6%3DEA9Zw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment