On Mon, Nov 27, 2017 at 3:21 AM, Joshua O. Morales <
joshuao.morale...@gmail.com> wrote:

> I tried it out, but I'm still getting 400 error.
>

400 means "Bad Request", if was something wrong inside the view, the server
should return a 500 (Internal Server Error). I think probably it isn't
executing at all...
If you remove the call_command does it works?


> I attached a copy of the tests.py of the app. Maybe you'll find something
> I can't.
>

Nope, I'm not into Selenium nor I can dedicate the time to learn it for
that. If it runs via a regular "python manage.py test seleniumapp" then
it's alright :)

>
> views.py:
>
> from django.shortcuts import render
> from django.core.management import call_command
>
>
> def start_scraping(request):
>     call_command('test','seleniumapp')
>     return render(request, 'seleniumapp/selenium.html')
>
> On Monday, November 27, 2017 at 3:40:58 AM UTC+8, Matemática A3K wrote:
>>
>>
>>
>> On Sun, Nov 26, 2017 at 11:03 AM, Joshua O. Morales <
>> joshuao....@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+unsubscr...@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/90dee471-a65b-404f-aa9f-b19223471944%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/90dee471-a65b-404f-aa9f-b19223471944%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@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%2BFDnhLHWcA1_66EkES3NioX_0G8%3D7yQPVYv_zJkLtxBz_DR4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to