Best way in Django to use single API 50000 times in one go

2021-04-23 Thread Sachin Kumar
Hi Experts,

Please help me out to use Single API, 5 times to complete the request.

for ex:- the request is of Enquiry of 5 cards. i just have a single API 
of Enquiry to fulfil this requirement.

Steps1:- I kept these 5 request in a table.
Step 3:- trigger an alert that request received and then 
Step2:- Pick cards 1 by 1 and trigger enquiry API and save the response in 
the table and make the details available in excel to download.  
Step4: alert that request has been completed.
Step 5:- stop all the operation running.

What would be the best way to achieve it ?

There shouldn't be any load on  application or server and request is 
completed.

Thanks in Advance
Sachin
 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6875e926-21a0-4edf-b2f9-410bc64a69fan%40googlegroups.com.


Oracle database sequences generated by Django

2021-04-23 Thread Harold A
Hello everyone.

I have a web application built in Django == 1.11.6, when the migrations 
were generated in oracle the sequences are created and they can be modified 
and even deleted. 

When I update to django 3 and I generate the migrations again, it creates 
the sequences with a name similar to this (ISEQ $$ _ 76200) but it does not 
allow me to edit them and or delete them, it shows me the following message 
(ORA-32794: cannot delete a sequence generated by the system). The downside 
is that I have a stored procedure that drops a stream and recreates it to 
load with data from other tables each time it is run. 
(BEGIN / * DELETE RPT DATA --- --- 
* / / * INITIALIZE THE SEQUENCE 
- - * / DELETE FROM 
SISREPORTS_RPT02; EXECUTE IMMEDIATE 'DROP SEQUENCE SISREPORTS_RPT02_SQ'; 
EXECUTE IMMEDIATE 'CREATE SEQUENCE SISREPORTS_RPT02_SQ INCREMENT BY 1 START 
WITH 1 MAXVALUE  MINVALUE 1 CACHE 20 '; 
/*FINISH --- 
 * /) 

 My question is that if the new versions of django can do some 
configuration before generating them migrations and can have the option to 
modify the oracle sequences.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0ac33519-682f-4c13-83d0-07810599f2aen%40googlegroups.com.


Re: Using Python Libraries in Django

2021-04-23 Thread Gabriel Araya Garcia
Felipe:
Mandame una muestra del archivo el cual usaría esta pequeña aplicación de
consulta, puede ser una tabla con los datos ya procesados (tú dices que con
pandas está sumando correctamente) ahora lo que necesitas es
la aplicación para que los demás funcionarios puedan ver los resultados
ordenados y/o graficados.
Pues bien, yo puedo construirte un aprox de esta consulta en Django, para
así darte una idea de cómo poder incorporar otras consultas.
Puede ser un excel o csv el que me envíes.

Gabriel Araya Garcia
GMI - Desarrollo de Sistemas Informáticos




El jue, 22 abr 2021 a las 13:19, felipe herrera ()
escribió:

> Hello! I would appreciate if someone could help me with a doubt I have
> about using Python libraries in Django. I will try to be as clear as
> possible so here it goes:
>
> In my job I work with invoices that are all saved in a specific directory
> (PDF files). In my job I am interested in only one specific value in a row
> which is a number. My job is to extract that value from all the invoices
> and sum them all. So, I made a python script  in which I use the libraries
> Pandas, os and PDFplumber and it works great. In code.png, you can see the
> loop I use to extract the row and value that I want by using PDFplumber and
> then sum all these values. In invoice.png you can see how PDFplumber
> divides the invoice in rows in columns.
>
> So, here is the thing: I want to deploy a Django App so that other people
> in the enterprise can use the python script I use ( they don't know
> anything about Python programming). So, I would want to deploy a Django app
> in which they can upload the directory with all the PDF files and then use
> the python script I show in code.png. But I'm having problems with the
> logic behind it. My questions are:
>
> 1) Can we use any python libraries in Django ( such as PDFplumber, pandas,
> etc) ?
> 2) Would I put my python script in views.py?  (Something like this)
>
>
> --- app/views.py
>
> import os
> import pdfplumber
> import pandas as pd
>
> *from* django.shortcuts *import* render
>
> *import* numpy *as* np
>
>
> *def* function(request):
>
> #Python script shown in code.png
>
> *return* render(request, 'app/response.html',{"data":data})
>
>
> Thank you beforehand!
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c8aab0fe-6d8a-4d94-a986-49a8ed4f3f32n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKVvSDBJaK2p-950sRrV6T3iuWc3ZJosoV3U_G-XaNr-P5k2BA%40mail.gmail.com.


Re: _set.all in a template with no results

2021-04-23 Thread Walter Randazzo
Dudes, I received online help.

In the template there was a mistype error:

{% for pagosdet in pagos.pagosdetail_set.all %}  => *
{% for pagosdet in pago.pagosdetail_set.all %}   ( Without 's')*

Thanks for reading,



El vie, 23 abr 2021 a las 17:37, Walter Randazzo ()
escribió:

> Hi there,  I am trying to list in a template a bunch of fields  of the
> model (PagosDetail) that is related to another one (PagosHead) via
> numero_pago field.
>
> I am able to list the PagosHead items  in the template but when I use the
> " _set.all" in order to get those fields from PagosDetail i've no luck.
>
> Hope you can help me guys!
>
>
>
> *Models*
> class PagosHead(models.Model):
> numero_pago = models.IntegerField()
> numero_socio = models.ForeignKey(Socios, on_delete=models.CASCADE)
>
> fecha_pago = models.DateField(default=datetime.now,null=True,blank=True)
>
> importe_pago_total = 
> models.DecimalField(default=0.00,max_digits=9,decimal_places=2)
> observaciones_pago = models.CharField(max_length=100,null=True)
>
> class PagosDetail(models.Model):
> pago=models.ForeignKey(PagosHead,on_delete=models.CASCADE)
>
> importe_pago = 
> models.DecimalField(default=0.00,max_digits=9,decimal_places=2)
> mes_pago = models.CharField(max_length=10)
> ano_pago = models.SmallIntegerField(null=True)
>
>
> *View*
> #Vista de Cuenta Corriente
> @method_decorator(staff_member_required, name='dispatch')
> class detalleCC(TemplateView):
> template_name = "pagos/cuenta_corriente.html"
> contexto={}
> print("En detalleCC view")
> def get_context_data(self, **kwargs):
> contexto = super(detalleCC, self).get_context_data(**kwargs)
> contexto={
>
> 'pagos': 
> PagosHead.objects.filter(numero_socio_id=self.kwargs['pk']),
> }
> return contexto
>
> *Template*
>
> {% for pago in pagos reversed %}
>   
>
>style="font-size:90%;">{{pago.numero_pago}}
>
>style="font-size:90%;">{{pago.fecha_pago}}
>
>style="font-size:90%;">{{pago.importe_pago_total}}
>
>style="font-size:90%;">{{pago.observaciones_pago}}
>
>role="button" data-toggle="tooltip" data-placement="top" title="Imprimir"> class="fa fa-print">
>   
>
>   {% for pagosdet in 
> pagos.pagosdetail_set.all %}
> 
>
>  style="font-size:90%;">{{pagosdet.mes_pago}}
> 
>   {% endfor %}
>   {% endfor %}
> 
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4ef2d447-48aa-4f44-9695-e72db04ecd70n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL7Dry4WYY9x0X-bSKRtO6CDUkk2k%3DtWZTioF5UZVG8mOQ9G4w%40mail.gmail.com.


Re: Using Python Libraries in Django

2021-04-23 Thread felipe herrera

Great video. Thank you Sr. ! 
El jueves, 22 de abril de 2021 a la(s) 19:05:50 UTC-5, Gerardo Palazuelos 
escribió:

> Have a look at the following video. It might help with your first question.
> https://youtu.be/04L0BbAcCpQ
>
> Regards,
>
> --
> Gerardo Palazuelos Guerrero
>
>
>
> On Thu, Apr 22, 2021 at 2:45 PM felipe herrera  wrote:
>
>> Awesome! Thank you . 
>>
>> Andrés 
>>
>> El jue, 22 de abr. de 2021 a la(s) 14:52, Kasper Laudrup (
>> lau...@stacktrace.dk) escribió:
>>
>>> On 22/04/2021 18.48, felipe herrera wrote:
>>> > 1) Can we use any python libraries in Django ( such as PDFplumber,
>>> > pandas, etc) ?
>>>
>>> Yes.
>>>
>>> Of course something like a Python library for rendering 3D graphics with
>>> OpenGL wouldn't make much sense to use for a web framework, but you can
>>> use any Python code with Django.
>>>
>>> > 2) Would I put my python script in views.py?  (Something like this) 
>>> > 
>>>
>>> That would probably be just fine most of the time and in this case it
>>> looks like the simplest thing to do.
>>>
>>> Kind regards,
>>>
>>> Kasper Laudrup
>>>
>>> -- 
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/dd418eeb-2799-c8bd-8916-8a83754bfeb5%40stacktrace.dk
>>> .
>>>
>> -- 
>> 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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAHg1JKz_ex0LHN2uFMU9Wing46eyRBrEAcWHw4B5cOTaJZMNgA%40mail.gmail.com
>>  
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8d6c9453-83b3-4987-98ac-f44aa1e1c2b0n%40googlegroups.com.


Re: Assistance for deploying django app to heroku

2021-04-23 Thread Irfan Khan
check this one
try to run the console
$ python manage.py sqlsequencereset your_app_name
it will give you the psql queries. run those queries on PSQL console and
then try to  run loaddata.

check below link

https://stackoverflow.com/questions/64251547/django-resync-autoincrementing-pk-with-restored-database


With Regards,
*Irfan khan*





On Sat, 24 Apr 2021 at 00:23, Kasper Laudrup  wrote:

> On 23/04/2021 20.41, Ejike Enyinnaya wrote:
> > I did a git add ., git commit -m and git push heroku master
>
> Not sure if it's related, but it's possible: This is not how you should
> use revision control (git).
>
> You should keep your source files under revision control, not just
> blindly add everything and committing it with an empty commit message.
> Then you might as well not use any kind of revision control at all.
>
> It might be slightly off topic and not related to your problem, but on
> the other hand, there's a huge chance that you have added a bunch of
> stuff like your database file and you have zero way of tracking what you
> have actually changed.
>
> Not sure if this has every worked for you, but if you have a similar
> problem and it used to work and then suddenly didn't, using revision
> control like git can be an enormous help.
>
> Do yourself a huge favor and learn how to use revision control.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4ebee094-cc84-ce01-ddfd-11ca231960d6%40stacktrace.dk
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALKGVip4zW6NTjTRGrg4d8OYEwjoAC7Q4FzqF6FDmAGTvNXNfQ%40mail.gmail.com.


_set.all in a template with no results

2021-04-23 Thread Walter Randazzo
Hi there,  I am trying to list in a template a bunch of fields  of the  
model (PagosDetail) that is related to another one (PagosHead) via 
numero_pago field.

I am able to list the PagosHead items  in the template but when I use the " 
_set.all" in order to get those fields from PagosDetail i've no luck. 

Hope you can help me guys!



*Models*
class PagosHead(models.Model):
numero_pago = models.IntegerField()
numero_socio = models.ForeignKey(Socios, on_delete=models.CASCADE)
fecha_pago = models.DateField(default=datetime.now,null=True,blank=True)
importe_pago_total = 
models.DecimalField(default=0.00,max_digits=9,decimal_places=2)
observaciones_pago = models.CharField(max_length=100,null=True)

class PagosDetail(models.Model):
pago=models.ForeignKey(PagosHead,on_delete=models.CASCADE)
importe_pago = 
models.DecimalField(default=0.00,max_digits=9,decimal_places=2)
mes_pago = models.CharField(max_length=10)
ano_pago = models.SmallIntegerField(null=True)


*View*
#Vista de Cuenta Corriente
@method_decorator(staff_member_required, name='dispatch')
class detalleCC(TemplateView):
template_name = "pagos/cuenta_corriente.html"  
contexto={}
print("En detalleCC view")
def get_context_data(self, **kwargs):
contexto = super(detalleCC, self).get_context_data(**kwargs)
contexto={
'pagos': 
PagosHead.objects.filter(numero_socio_id=self.kwargs['pk']),
}
return contexto

*Template*
  
{% for pago in pagos reversed %}
  
  {{pago.numero_pago}}
  {{pago.fecha_pago}}
  {{pago.importe_pago_total}}
  {{pago.observaciones_pago}}
  
  
  {% for pagosdet in 
pagos.pagosdetail_set.all %}

{{pagosdet.mes_pago}}

  {% endfor %}
  {% endfor %}


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4ef2d447-48aa-4f44-9695-e72db04ecd70n%40googlegroups.com.


Re: Assistance for deploying django app to heroku

2021-04-23 Thread Kasper Laudrup
On 23/04/2021 20.41, Ejike Enyinnaya wrote:
> I did a git add ., git commit -m and git push heroku master

Not sure if it's related, but it's possible: This is not how you should
use revision control (git).

You should keep your source files under revision control, not just
blindly add everything and committing it with an empty commit message.
Then you might as well not use any kind of revision control at all.

It might be slightly off topic and not related to your problem, but on
the other hand, there's a huge chance that you have added a bunch of
stuff like your database file and you have zero way of tracking what you
have actually changed.

Not sure if this has every worked for you, but if you have a similar
problem and it used to work and then suddenly didn't, using revision
control like git can be an enormous help.

Do yourself a huge favor and learn how to use revision control.

Kind regards,

Kasper Laudrup

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4ebee094-cc84-ce01-ddfd-11ca231960d6%40stacktrace.dk.


OpenPGP_signature
Description: OpenPGP digital signature


Re: Assistance for deploying django app to heroku

2021-04-23 Thread Sujayeendra G
Please explain all your steps clearly.

How are you creating fixture.json, Are you taking all data dump or only
book model dump ??


On Sat, 24 Apr 2021 at 00:12, Ejike Enyinnaya 
wrote:

> Hi Guys,
>
> This is the error I am getting:
>
> (first_django_app) ➜  first_django_app git:(master)  heroku run python
> manage.py loaddata books/fixtures.json
> Running python manage.py loaddata books/fixtures.json on ⬢ gotbooksapp...
> up, run.6617 (Free)
> Traceback (most recent call last):
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
> line 82, in _execute
> return self.cursor.execute(sql)
> psycopg2.errors.ForeignKeyViolation: insert or update on table
> "books_book" violates foreign key constraint
> "books_book_user_id_4b809191_fk_auth_user_id"
> DETAIL:  Key (user_id)=(1) is not present in table "auth_user".
>
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File "manage.py", line 21, in 
> main()
>   File "manage.py", line 17, in main
> execute_from_command_line(sys.argv)
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py",
> line 419, in execute_from_command_line
> utility.execute()
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py",
> line 413, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py",
> line 354, in run_from_argv
> self.execute(*args, **cmd_options)
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py",
> line 398, in execute
> output = self.handle(*args, **options)
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/commands/loaddata.py",
> line 78, in handle
> self.loaddata(fixture_labels)
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/commands/loaddata.py",
> line 131, in loaddata
> connection.check_constraints(table_names=table_names)
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/postgresql/base.py",
> line 285, in check_constraints
> cursor.execute('SET CONSTRAINTS ALL IMMEDIATE')
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
> line 98, in execute
> return super().execute(sql, params)
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
> line 66, in execute
> return self._execute_with_wrappers(sql, params, many=False,
> executor=self._execute)
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
> line 75, in _execute_with_wrappers
> return executor(sql, params, many, context)
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
> line 84, in _execute
> return self.cursor.execute(sql, params)
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/db/utils.py", line
> 90, in __exit__
> raise dj_exc_value.with_traceback(traceback) from exc_value
>   File
> "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
> line 82, in _execute
> return self.cursor.execute(sql)
> django.db.utils.IntegrityError: Problem installing fixtures: insert or
> update on table "books_book" violates foreign key constraint
> "books_book_user_id_4b809191_fk_auth_user_id"
> DETAIL:  Key (user_id)=(1) is not present in table "auth_user".
>
> I have done the following: rm -f db.sqlite3
> run python manage.py makemigrations
> run python manage.py migrate
> I had to add all the information again as the database had been cleaned out
> I then implement fixtures.json locally
> I did a git add ., git commit -m and git push heroku master
> I did run heroku run python manage.py migrate
> I finally run python manage.py loaddata books/fixtures.json
> I still have the same errors again
>
> BR,
>
> Ejike Chiboka
> 0804537; 08166516400
>
>
> On Fri, Apr 23, 2021 at 7:28 PM Sujayeendra G 
> wrote:
>
>>
>> Hi,
>>
>> You can see IntegrityError: fixtures you are updating trying to find user
>> with user_id=1 which are not available in your db. Try to create one user
>> and migrate again. Or if the App is still in the development stage. Delete
>> DB and migrate again. It may work.
>>
>> Thank you
>>
>> Regards
>> Sujay
>>
>>
>> On Fri, 23 Apr 2021 at 17:25, ejike@gmail.com <
>> ejike.chib...@gmail.com> wrote:
>>
>>> Good day All,
>>>
>>> I am trying to deploy my django app to heroku but i keep getting this
>>> error in the screenshot attached.
>>>
>>> Please can anyone assist in me in finding a solution to this and where
>>> the issue could be coming from.
>>>
>>> Looking forward to your replies.
>>>
>>> Thanks and BR,
>>>
>>> Ejike
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" gr

Re: Assistance for deploying django app to heroku

2021-04-23 Thread Ejike Enyinnaya
Hi Guys,

This is the error I am getting:

(first_django_app) ➜  first_django_app git:(master)  heroku run python
manage.py loaddata books/fixtures.json
Running python manage.py loaddata books/fixtures.json on ⬢ gotbooksapp...
up, run.6617 (Free)
Traceback (most recent call last):
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
line 82, in _execute
return self.cursor.execute(sql)
psycopg2.errors.ForeignKeyViolation: insert or update on table "books_book"
violates foreign key constraint
"books_book_user_id_4b809191_fk_auth_user_id"
DETAIL:  Key (user_id)=(1) is not present in table "auth_user".


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 21, in 
main()
  File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py",
line 419, in execute_from_command_line
utility.execute()
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py",
line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py",
line 354, in run_from_argv
self.execute(*args, **cmd_options)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py",
line 398, in execute
output = self.handle(*args, **options)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/core/management/commands/loaddata.py",
line 78, in handle
self.loaddata(fixture_labels)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/core/management/commands/loaddata.py",
line 131, in loaddata
connection.check_constraints(table_names=table_names)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/postgresql/base.py",
line 285, in check_constraints
cursor.execute('SET CONSTRAINTS ALL IMMEDIATE')
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
line 98, in execute
return super().execute(sql, params)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
line 66, in execute
return self._execute_with_wrappers(sql, params, many=False,
executor=self._execute)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
line 84, in _execute
return self.cursor.execute(sql, params)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/utils.py", line
90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
line 82, in _execute
return self.cursor.execute(sql)
django.db.utils.IntegrityError: Problem installing fixtures: insert or
update on table "books_book" violates foreign key constraint
"books_book_user_id_4b809191_fk_auth_user_id"
DETAIL:  Key (user_id)=(1) is not present in table "auth_user".

I have done the following: rm -f db.sqlite3
run python manage.py makemigrations
run python manage.py migrate
I had to add all the information again as the database had been cleaned out
I then implement fixtures.json locally
I did a git add ., git commit -m and git push heroku master
I did run heroku run python manage.py migrate
I finally run python manage.py loaddata books/fixtures.json
I still have the same errors again

BR,

Ejike Chiboka
0804537; 08166516400


On Fri, Apr 23, 2021 at 7:28 PM Sujayeendra G 
wrote:

>
> Hi,
>
> You can see IntegrityError: fixtures you are updating trying to find user
> with user_id=1 which are not available in your db. Try to create one user
> and migrate again. Or if the App is still in the development stage. Delete
> DB and migrate again. It may work.
>
> Thank you
>
> Regards
> Sujay
>
>
> On Fri, 23 Apr 2021 at 17:25, ejike@gmail.com 
> wrote:
>
>> Good day All,
>>
>> I am trying to deploy my django app to heroku but i keep getting this
>> error in the screenshot attached.
>>
>> Please can anyone assist in me in finding a solution to this and where
>> the issue could be coming from.
>>
>> Looking forward to your replies.
>>
>> Thanks and BR,
>>
>> Ejike
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/7c7fd9ab-20a6-43f3-9793-06ea0f4220c6n%40googlegroups.com
>> 
>> .
>>
> -

Re: Assistance for deploying django app to heroku

2021-04-23 Thread Sujayeendra G
Hi,

You can see IntegrityError: fixtures you are updating trying to find user
with user_id=1 which are not available in your db. Try to create one user
and migrate again. Or if the App is still in the development stage. Delete
DB and migrate again. It may work.

Thank you

Regards
Sujay


On Fri, 23 Apr 2021 at 17:25, ejike@gmail.com 
wrote:

> Good day All,
>
> I am trying to deploy my django app to heroku but i keep getting this
> error in the screenshot attached.
>
> Please can anyone assist in me in finding a solution to this and where the
> issue could be coming from.
>
> Looking forward to your replies.
>
> Thanks and BR,
>
> Ejike
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7c7fd9ab-20a6-43f3-9793-06ea0f4220c6n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJ15Ob0pe9%3DpT56vqkbYNE_6sp5qYgts7aYtnCTVqfdaSOQ%2B6g%40mail.gmail.com.


Re: Assistance for deploying django app to heroku

2021-04-23 Thread Mohammad Anarul
kindly shere your code

On Fri, Apr 23, 2021 at 5:56 PM ejike@gmail.com 
wrote:

> Good day All,
>
> I am trying to deploy my django app to heroku but i keep getting this
> error in the screenshot attached.
>
> Please can anyone assist in me in finding a solution to this and where the
> issue could be coming from.
>
> Looking forward to your replies.
>
> Thanks and BR,
>
> Ejike
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7c7fd9ab-20a6-43f3-9793-06ea0f4220c6n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE59x8dUHT263JBeJhyqR7ZtHA9FRpvfT98H73Vquo9qhP3QWw%40mail.gmail.com.


Re: Deploying my Django App to Heroku

2021-04-23 Thread Ayser shuhaib
Make sure you create the user objects in the database before loading the
books data

On Fri, 23 Apr 2021 at 14:02, Nzekwe Isaac  wrote:

> I think there's a problem with your database. Try deleting your dbsqlite
> database and run migrations a again.
>
> On Fri, 23 Apr 2021, 12:50 Ejike Enyinnaya, 
> wrote:
>
>> Good day Isaac,
>>
>> I ran makemigrations and migrate before deploy as seen in my screenshots
>> but I am still having the same problem.
>>
>> Find attached my screenshots.
>>
>> Please what else should i look at?
>> BR,
>> Ejike Chiboka
>> 0804537; 08166516400
>>
>>
>> On Wed, Apr 21, 2021 at 11:44 PM Nzekwe Isaac  wrote:
>>
>>> Try running makemigrations and migrations again before deploying again
>>>
>>> On Wed, 21 Apr 2021, 22:30 ejike@gmail.com, 
>>> wrote:
>>>
 Good day All,

 Please I am trying to deploy my App which uses Django/Python as the
 backend and React as the frontend to Heroku but I keep getting this error
 in the attached picture.

 Also attached is a screenshot of my Models.py.

 I would be very grateful for any assistance.

 Kind Regards,

 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/287b1a3a-abc5-4848-ade7-2de414e7b549n%40googlegroups.com
 
 .

>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CACD%2B4V%3DPmh1OJbEYPW5u6vJG_aovPE-2vnHmwNGQrddbNjqHQg%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CADe59C9cyhquav%2Be-%3Dgh59Kaj2xDeqmnUg0e4vHtJcX1VK8Ztg%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACD%2B4VmnG7WD5%2BrJX7z0ZPjYZ9iPv6Ykc6QZw4Rb6aCDi39veA%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE0AZGKMpOoA6xHsA9j0iWy1X-8hqLM3yJm9rHDV%2BeN2DjJNNg%40mail.gmail.com.


Re: Deploying my Django App to Heroku

2021-04-23 Thread Nzekwe Isaac
I think there's a problem with your database. Try deleting your dbsqlite
database and run migrations a again.

On Fri, 23 Apr 2021, 12:50 Ejike Enyinnaya,  wrote:

> Good day Isaac,
>
> I ran makemigrations and migrate before deploy as seen in my screenshots
> but I am still having the same problem.
>
> Find attached my screenshots.
>
> Please what else should i look at?
> BR,
> Ejike Chiboka
> 0804537; 08166516400
>
>
> On Wed, Apr 21, 2021 at 11:44 PM Nzekwe Isaac  wrote:
>
>> Try running makemigrations and migrations again before deploying again
>>
>> On Wed, 21 Apr 2021, 22:30 ejike@gmail.com, 
>> wrote:
>>
>>> Good day All,
>>>
>>> Please I am trying to deploy my App which uses Django/Python as the
>>> backend and React as the frontend to Heroku but I keep getting this error
>>> in the attached picture.
>>>
>>> Also attached is a screenshot of my Models.py.
>>>
>>> I would be very grateful for any assistance.
>>>
>>> Kind Regards,
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/287b1a3a-abc5-4848-ade7-2de414e7b549n%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACD%2B4V%3DPmh1OJbEYPW5u6vJG_aovPE-2vnHmwNGQrddbNjqHQg%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CADe59C9cyhquav%2Be-%3Dgh59Kaj2xDeqmnUg0e4vHtJcX1VK8Ztg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACD%2B4VmnG7WD5%2BrJX7z0ZPjYZ9iPv6Ykc6QZw4Rb6aCDi39veA%40mail.gmail.com.


Re: Testing Django User Login Form

2021-04-23 Thread lone...@gmail.com
Thank you for the reply!  I will totally try this tonight!

On Thursday, April 22, 2021 at 7:31:40 PM UTC-4 David Nugent wrote:

> Try creating a request using RequestFactory and use that to input the 
> credentials. I don't think the way you are creating the form is valid.
>
> rf = RequestFactory()
> request = rf.post('/some_mock_url', dict(username='abc', 
> password='password'))
> form = AuthenticationForm(request)
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e3079f83-6175-4852-9a6a-f94625079af4n%40googlegroups.com.


RE: [EXTERNAL]Re: #Beginnerlevel Form sending get instead of post request

2021-04-23 Thread Chaitanya Sakoji
Thank Agoua. It worked after update.

From: django-users@googlegroups.com  On Behalf 
Of Agoua David
Sent: 23 April 2021 13:08
To: django-users@googlegroups.com
Subject: Re: [EXTERNAL]Re: #Beginnerlevel Form sending get instead of post 
request

I think it's because tour submit button IS not in the form

Le ven. 23 avr. 2021 à 01:58, Chaitanya Sakoji 
mailto:chaitanya.sak...@cerence.com>> a écrit :
Thanks Kasper for your reply.

-Original Message-
From: django-users@googlegroups.com 
mailto:django-users@googlegroups.com>> On Behalf 
Of Kasper Laudrup
Sent: 23 April 2021 01:17
To: django-users@googlegroups.com
Subject: [EXTERNAL]Re: #Beginnerlevel Form sending get instead of post request

On 22/04/2021 17.14, chaitanya sakoji wrote:
> Previously this code was sending post request. Suddenly after
> restarting server, it started sending get.

I *think* I might understand what you mean.

The code you posted doesn't send anything. It handles POST request sent from 
your browser. If you load a page with your browser normally, it will send a GET 
request.

My guess is, that you've sent a POST request to the page (which works
fine) and then you load the same page in your browser sending a GET request.

Could that explain it.

Just to be clear. Your code will not start changing behavior without you doing 
anything (self modifying code is indeed a thing, but that's not relevant here 
at all).

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to a topic in the Google 
Groups "Django users" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/django-users/x6_U7_hCeOY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4c96bea3-db71-ca42-7158-9e1f3a9bc6ea%40stacktrace.dk.

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/BN6PR08MB23882B77FEB28076EDA82B1A97459%40BN6PR08MB2388.namprd08.prod.outlook.com.
--
You received this message because you are subscribed to a topic in the Google 
Groups "Django users" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/django-users/x6_U7_hCeOY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAByCr6goGGGW14MU7qmVeZo81pEULzaJVhhQbxH2%2B9%2Br6hWmAg%40mail.gmail.com

Re: Using Python Libraries in Django

2021-04-23 Thread Agoua David
Yes it's possible to use other python library, and for second question i
think it's better to encapsulate tour code in a class toi create a service
and call it in your  views. This a clean way and like this your Can call it
in a thread if you want to savez Time.

Le ven. 23 avr. 2021 à 00:05, Gerardo Palazuelos Guerrero <
gerardo.palazue...@gmail.com> a écrit :

> Have a look at the following video. It might help with your first question.
> https://youtu.be/04L0BbAcCpQ
>
> Regards,
>
> --
> Gerardo Palazuelos Guerrero
>
>
>
> On Thu, Apr 22, 2021 at 2:45 PM felipe herrera 
> wrote:
>
>> Awesome! Thank you .
>>
>> Andrés
>>
>> El jue, 22 de abr. de 2021 a la(s) 14:52, Kasper Laudrup (
>> laud...@stacktrace.dk) escribió:
>>
>>> On 22/04/2021 18.48, felipe herrera wrote:
>>> > 1) Can we use any python libraries in Django ( such as PDFplumber,
>>> > pandas, etc) ?
>>>
>>> Yes.
>>>
>>> Of course something like a Python library for rendering 3D graphics with
>>> OpenGL wouldn't make much sense to use for a web framework, but you can
>>> use any Python code with Django.
>>>
>>> > 2) Would I put my python script in views.py?  (Something like this)
>>> >
>>>
>>> That would probably be just fine most of the time and in this case it
>>> looks like the simplest thing to do.
>>>
>>> Kind regards,
>>>
>>> Kasper Laudrup
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/dd418eeb-2799-c8bd-8916-8a83754bfeb5%40stacktrace.dk
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAHg1JKz_ex0LHN2uFMU9Wing46eyRBrEAcWHw4B5cOTaJZMNgA%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJ8iCyM4i3PdCM2d22ou5Ue7roC5dktDDEPBgWtqk3mMwjr8Wg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAByCr6ic%2BvW7Zf8MFimV4D4mKXNyYtVLZFSPSynfNrE7ar0Ljg%40mail.gmail.com.


Re: [EXTERNAL]Re: #Beginnerlevel Form sending get instead of post request

2021-04-23 Thread Agoua David
I think it's because tour submit button IS not in the form

Le ven. 23 avr. 2021 à 01:58, Chaitanya Sakoji 
a écrit :

> Thanks Kasper for your reply.
>
> -Original Message-
> From: django-users@googlegroups.com  On
> Behalf Of Kasper Laudrup
> Sent: 23 April 2021 01:17
> To: django-users@googlegroups.com
> Subject: [EXTERNAL]Re: #Beginnerlevel Form sending get instead of post
> request
>
> On 22/04/2021 17.14, chaitanya sakoji wrote:
> > Previously this code was sending post request. Suddenly after
> > restarting server, it started sending get.
>
> I *think* I might understand what you mean.
>
> The code you posted doesn't send anything. It handles POST request sent
> from your browser. If you load a page with your browser normally, it will
> send a GET request.
>
> My guess is, that you've sent a POST request to the page (which works
> fine) and then you load the same page in your browser sending a GET
> request.
>
> Could that explain it.
>
> Just to be clear. Your code will not start changing behavior without you
> doing anything (self modifying code is indeed a thing, but that's not
> relevant here at all).
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/x6_U7_hCeOY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4c96bea3-db71-ca42-7158-9e1f3a9bc6ea%40stacktrace.dk
> .
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/BN6PR08MB23882B77FEB28076EDA82B1A97459%40BN6PR08MB2388.namprd08.prod.outlook.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAByCr6goGGGW14MU7qmVeZo81pEULzaJVhhQbxH2%2B9%2Br6hWmAg%40mail.gmail.com.