Saturday, April 24, 2021

Re: Using Python Libraries in Django

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 (<quechua685@gmail.com>) 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+unsubscribe@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+unsubscribe@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.

No comments:

Post a Comment