my project doesnt insert into the database

2022-10-28 Thread Otávio Augusto
Greetings, I'm doing a integration projection, so I need to consume data 
from a RESTful API and then save that data inside a oracle db. My models 
migrated and succesfully created the tables, I was able to get the data 
from the API and parse trough it to filter the info I wanted and needed to 
save normally, then I first used 'objects.update_or_create' to populate my 
table, initially it seemed to work but after some time it got stuck and 
stopped inserting data into the table, I tried to switch to simply 
'objects.create' but it didnt work. I dont seem to find the issue that is 
holding the insertion in place and decided to seek for help.

For illustration, this is how I builted the code block that is getting 
stuck:
for item in value_list['itens']:
 print(item)
 Item.objects.using('default').create(
  nature=item['nature'],
  date=item['date'],
  doc_number=item['doc_number'],
  name=item['name'],
  description=item['description']
)

I even added .save(force_insert=True) to try and brute force the insertion 
on the table but no avail. Need help!

-- 
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/9c187dbe-f1ca-4027-9156-a3c859f64d70n%40googlegroups.com.


Re: my project doesnt insert into the database

2022-10-31 Thread Otávio Augusto
it just hang, doesnt crash nor raise any errors or exceptions, I even tried 
to cover it up in a try block but it did not return an error. 

Em sábado, 29 de outubro de 2022 às 08:38:04 UTC-4, Ryan Nowakowski 
escreveu:

> When it gets stuck, does it crash and return a traceback or just hang?
>
>
> On October 28, 2022 9:16:41 AM CDT, "Otávio Augusto"  
> wrote:
>>
>> Greetings, I'm doing a integration projection, so I need to consume data 
>> from a RESTful API and then save that data inside a oracle db. My models 
>> migrated and succesfully created the tables, I was able to get the data 
>> from the API and parse trough it to filter the info I wanted and needed to 
>> save normally, then I first used 'objects.update_or_create' to populate my 
>> table, initially it seemed to work but after some time it got stuck and 
>> stopped inserting data into the table, I tried to switch to simply 
>> 'objects.create' but it didnt work. I dont seem to find the issue that is 
>> holding the insertion in place and decided to seek for help.
>>
>> For illustration, this is how I builted the code block that is getting 
>> stuck:
>> for item in value_list['itens']:
>>  print(item)
>>  Item.objects.using('default').create(
>>   nature=item['nature'],
>>   date=item['date'],
>>   doc_number=item['doc_number'],
>>   name=item['name'],
>>   description=item['description']
>> )
>>
>> I even added .save(force_insert=True) to try and brute force the 
>> insertion on the table but no avail. Need help!
>>
>>

-- 
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/98413279-103c-40a9-bb1a-6f26aa9dfe83n%40googlegroups.com.


Re: my project doesnt insert into the database

2022-11-01 Thread Otávio Augusto
Solved. I added a sleep at the end of my loop and it worked, I think it was 
getting stuck because the db was not able to keep up with the update from 
the app and so the session got interrupted.

Em sexta-feira, 28 de outubro de 2022 às 10:46:54 UTC-4, Otávio Augusto 
escreveu:

> Greetings, I'm doing a integration projection, so I need to consume data 
> from a RESTful API and then save that data inside a oracle db. My models 
> migrated and succesfully created the tables, I was able to get the data 
> from the API and parse trough it to filter the info I wanted and needed to 
> save normally, then I first used 'objects.update_or_create' to populate my 
> table, initially it seemed to work but after some time it got stuck and 
> stopped inserting data into the table, I tried to switch to simply 
> 'objects.create' but it didnt work. I dont seem to find the issue that is 
> holding the insertion in place and decided to seek for help.
>
> For illustration, this is how I builted the code block that is getting 
> stuck:
> for item in value_list['itens']:
>  print(item)
>  Item.objects.using('default').create(
>   nature=item['nature'],
>   date=item['date'],
>   doc_number=item['doc_number'],
>   name=item['name'],
>   description=item['description']
> )
>
> I even added .save(force_insert=True) to try and brute force the insertion 
> on the table but no avail. Need help!
>

-- 
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/d37b05ad-7ea7-44a4-bdb2-86742c7622b7n%40googlegroups.com.


Django virtualenv, pythonpath issues

2012-05-15 Thread Otávio Augusto Soares


I'm trying to deploy a django app with virtualenv but I'm not a linux 
expert user.

It's on a shared host. If I type python I got the python 2.4 console. If a 
type python2.7 I got the 2.7 console.

I want to use the 2.7.

   1. I installed virtualenv with setuptools in my private .site-packages.
   2. I created my env using python 2.7: .site-packages/virtualenv 
   --no-site-packages -p python2.7 env
   3. I activated my env and installed the packages I need.
   4. I configured (tried to) my .wsgi to use the env

I've been 2 days in step 4. The server has some pre installed modules, 
which are on sys.path. For example, it has django installed, but I want to 
use the module installed in my virtualenv.

I read several wsgi documentation and I came to this:

import sys, os, site

sys.stdout = sys.stderr

os.environ['PYTHON_EGG_CACHE'] = '/home/bruddennautica/apps_wsgi/.python-eggs'
os.environ['DJANGO_SETTINGS_MODULE'] = "brudden.settings"

sys.path.append('/home/bruddennautica/apps_wsgi')
sys.path.append('/home/bruddennautica/apps_wsgi/env/lib/python2.7/site-packages')

activate_this = '/home/bruddennautica/apps_wsgi/env/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

With this conf, I got a django error which shows me some things. The django 
error isn't important, it's caused because the django version is not equal 
to the one I installed in my virtualenv, the python version either.

PRINT: http://dl.dropbox.com/u/9290581/error.png

It's possible to see the python path entries, most of them not from 
virtualenv. The first one is: 
/home/bruddennautica/apps_wsgi/env/lib/python2.4/site-packages. However 
this folder doesn't exists. Apparently it's added by activate_this.py in 
line 22:

site_packages = os.path.join(base, 'lib', 'python%s' % sys.version[:3], 
'site-packages')

Anyone can help me?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ETGErWaZyMoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.