Django 2.2 mongoengine query pagination performance

2019-08-07 Thread Felix Tillyard
Hi,

We are facing an issue while upgrading from Django 2.1.10 to 2.2.4. We are 
using mongoengine (http://mongoengine.org/) to pull some documents from a 
Mongo database. Following the upgrade performance of this is significantly 
worse.

We ran some profiling using pyspy (https://github.com/benfred/py-spy) which 
produced the attached charts.

Basically it seems like there are many extra function calls, seemingly 
related to pagination, and the control flow here is different following the 
upgrade.

Any ideas / help would be amazing!

Thanks

-- 
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/76590bde-a7bb-4820-bacf-e1a8c3ec13c1%40googlegroups.com.


Re: mongoengine

2019-02-05 Thread thammanenitcs
I am not sure but try to import mongoengine.

I am also trying many ways to get this combo integration.



On Monday, February 4, 2019 at 11:29:16 PM UTC+5:30, B.navya spoorthi 
Sweety wrote:
>
> hi all
>  
> i am trying django with mongo
>
> i added following lines in settings.py
>
> mongoengine.connect(
> db="tools",
> host="localhost"
> )
>
> i am seeing error 
>   File "", line 697, in exec_module
>   File "", line 222, in 
> _call_with_frames_removed
>   File "C:\c_burra_mongo_1\mysite\mysite\settings.py", line 124, in 
> 
> mongoengine.connect(
> NameError: name 'mongoengine' is not defined
>
> i am aware that i need to change something here
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.sqlite3',
> 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
> }
> }
>
> but not sure what to change
>

-- 
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/7012c024-c5c9-40fa-83e1-0dbc6b6cd9f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


mongoengine

2019-02-04 Thread B.navya spoorthi Sweety
hi all
 
i am trying django with mongo

i added following lines in settings.py

mongoengine.connect(
db="tools",
host="localhost"
)

i am seeing error 
  File "", line 697, in exec_module
  File "", line 222, in 
_call_with_frames_removed
  File "C:\c_burra_mongo_1\mysite\mysite\settings.py", line 124, in 
    mongoengine.connect(
NameError: name 'mongoengine' is not defined

i am aware that i need to change something here
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

but not sure what to change

-- 
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/39ae38f8-c165-4c1d-af0c-4ad167065e40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need help in posting Multi select option from HTML to MongoDB using Mongoengine

2017-03-07 Thread Carlos Andre
Vinay to this do the simple.
The form interprets normally the models.
Example:
models.py
from mongoengine import *

class person(Document):
  name = StringField(max_length = 150)
  club = EmbeddedModelField(club)

class club(Document):
 name = StringFiend(max_length = 150)

form.py
class FormPerson(forms.ModelForm):
 class Meta:
model = person
fields = "__all__"


2017-03-07 0:58 GMT-03:00 vinay.marpina :

> Hi All,
>
> I am trying to implement a Multi select input box in my Html page. Once
> user select multiple check boxes all the data for that specific field need
> to store in MongoDB as a part of json. I am not able to understand how i
> can Multi Select input box created in Html can be connected to Back end
> model. I ma trying to use List field and Embedded document field but i am
> not able to connect all the dots. Can some one please help me in connecting
> all the dots from HTML to FORM to Model to View to MongoDB. Examples are
> very limited for Mongoengine and most of them are not taking input from
> HTML page. If some one let me know how to provide multiple input from HTML
> page to model list field it will be very help full.
>
> Note: If my explanation is vague please ping me i will try to explain
> little better.
>
> Thanks,
> Vinay
>
> --
> 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/c0a4cef0-d2ec-4bd0-b28d-517dc912e5cb%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c0a4cef0-d2ec-4bd0-b28d-517dc912e5cb%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/CAA8yBMxFGjgqUNXZdTg3R%3DdbbYnqQhU0cAFOMS1VLGM7SEm4Rw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Need help in posting Multi select option from HTML to MongoDB using Mongoengine

2017-03-07 Thread vinay.marpina
Hi All,

I am trying to implement a Multi select input box in my Html page. Once 
user select multiple check boxes all the data for that specific field need 
to store in MongoDB as a part of json. I am not able to understand how i 
can Multi Select input box created in Html can be connected to Back end 
model. I ma trying to use List field and Embedded document field but i am 
not able to connect all the dots. Can some one please help me in connecting 
all the dots from HTML to FORM to Model to View to MongoDB. Examples are 
very limited for Mongoengine and most of them are not taking input from 
HTML page. If some one let me know how to provide multiple input from HTML 
page to model list field it will be very help full.

Note: If my explanation is vague please ping me i will try to explain 
little better.

Thanks,
Vinay

-- 
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/c0a4cef0-d2ec-4bd0-b28d-517dc912e5cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django MongoEngine rest api app post request.POST.get('id')

2016-09-28 Thread Peter of the Norse
Are you doing request.POST.get(’taxi_id’) here?  Because that will return a 
string.  And in that case, id would be each letter in the actual ID.  Try 
switching it to request.POST.getlist(’taxi_id’).

> On Sep 27, 2016, at 9:43 AM, samer sarker  wrote:
> 
>  for id in taxi_id:
> taxi = TaxiMaster.objects(id=id).first()
> 
> temp = BookedTaxi(
> taxi_id=id,
> driver_id=taxi.user_id,
> is_seen=0,
> is_accepted=0,
> is_rejected=0
> )
> 
> 
> 
> 
> 
> 
> ValidationError at /action
> 
> u'5' is not a valid ObjectId, it must be a 12-byte input of type 'str' or a 
> 24-character hex string
> 
> 
> 
> how to solve this 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/57545fd3-2460-44ee-8988-079998523a54%40googlegroups.com
>  
> .
> For more options, visit https://groups.google.com/d/optout 
> .

Peter of the Norse
rahmc...@radio1190.org



-- 
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/2FE239C8-4A1A-4C3F-8B10-6B7DB2BEF693%40Radio1190.org.
For more options, visit https://groups.google.com/d/optout.


Re: Django MongoEngine rest api app post request.POST.get('id')

2016-09-28 Thread Armando Licurgo
observ this:
 .objects(id=id).

Armando Licurgo


2016-09-27 12:43 GMT-03:00 samer sarker :

>  for id in taxi_id:
> taxi = TaxiMaster.objects(id=id).first()
>
> temp = BookedTaxi(
> taxi_id=id,
> driver_id=taxi.user_id,
> is_seen=0,
> is_accepted=0,
> is_rejected=0
> )
>
>
>
> ValidationError at /action
>
> u'5' is not a valid ObjectId, it must be a 12-byte input of type 'str' or a 
> 24-character hex string
>
>
>
> how to solve this 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/57545fd3-2460-44ee-8988-079998523a54%40googlegroups.com
> 
> .
> 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/CAJjP4nM4F7Q6pT%2Bua2r%2Bs_U_01A0PbvjpcvcXzSPomonmCF7ag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django MongoEngine rest api app post request.POST.get('id')

2016-09-27 Thread samer sarker
 for id in taxi_id:
taxi = TaxiMaster.objects(id=id).first()

temp = BookedTaxi(
taxi_id=id,
driver_id=taxi.user_id,
is_seen=0,
is_accepted=0,
is_rejected=0
)



ValidationError at /action 

u'5' is not a valid ObjectId, it must be a 12-byte input of type 'str' or a 
24-character hex string



how to solve this 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/57545fd3-2460-44ee-8988-079998523a54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django rest framework with mongoengine login

2015-08-20 Thread Selva sundar raj
currently i am doing application in DRF with mongoengine ,
in that how to do login with mongoengine user
any can help me?

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bd57d177-cb0c-4c18-a54d-191175fe5c76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django tests, mongoengine, and unique_with constraint

2014-02-25 Thread Loutre
It works if I call insure_indexes() method. I can't understand why. Is 
there to avoid it ?

My code that works :

>
> from django.test import TestCase
> from les_classiques.models import Author
> import mongoengine
>
>
> class DatabaseTest(TestCase):
> def setUp(self):
> db = mongoengine.connection.get_db()
> for collection in 
> db.collection_names(include_system_collections=False):
> db.drop_collection(collection)
>
> def test_insert_new_author(self):
> author = Author(name='Hugo', first_name='Victor')
> author.save()
> db_author = Author.objects(name='Hugo', first_name='Victor')[0]
> self.assertEqual(db_author.name, 'Hugo')
>
> def test_insert_duplicate_author_failure(self):
>
  Author.insure_indexes()

> author = Author(name='Peguy', first_name='Charles')
> author2 = Author(name='Peguy', first_name='Charles')
> author.save()
> self.assertRaises(mongoengine.NotUniqueError, author2.save)
>
>
>
>
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/516c3bc1-fa7a-45e4-8041-8880aa24aeee%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django tests, mongoengine, and unique_with constraint

2014-02-25 Thread Loutre

>
> I realized that indexes have not been created by mongoengine :
>
db.author.getIndexes()
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"ns" : "poesie.author",
"name" : "_id_"
}
]

I'm still searching for a solution...

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a5db2944-2f6a-4ca8-b5f1-d84acecca13e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django tests, mongoengine, and unique_with constraint

2014-02-25 Thread Loutre

>
> NB : I use Python 3.3.4, mongoengine 0.8.7, Django 1.6.2 and mongodb 2.0.6
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8b9f584f-2b58-4f00-bc42-a4e20f24cbf5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


django tests, mongoengine, and unique_with constraint

2014-02-25 Thread Loutre
Hi everybody,

I'm facing the following problem with Mongodb.

I've got the following model : 


from mongoengine import Document, StringField, DateTimeField


class Author(Document):
name = StringField(max_length=50, required=True)
first_name = StringField(max_length=50, required=True, 
unique_with='name')
birthday = DateTimeField(default=None)
death_day = DateTimeField(default=None)

meta = {
'indexes': [('name', '+first_name')]
}

Nothing special there, except that 'firstname' should be unique with 'name'.

I wrote the following test suite :

from django.test import TestCase
from les_classiques.models import Author
import mongoengine


class DatabaseTest(TestCase):
def setUp(self):
db = mongoengine.connection.get_db()
for collection in 
db.collection_names(include_system_collections=False):
db.drop_collection(collection)

def test_insert_new_author(self):
author = Author(name='Hugo', first_name='Victor')
author.save()
db_author = Author.objects(name='Hugo', first_name='Victor')[0]
self.assertEqual(db_author.name, 'Hugo')

def test_insert_duplicate_author_failure(self):
author = Author(name='Peguy', first_name='Charles')
author2 = Author(name='Peguy', first_name='Charles')
author.save()
self.assertRaises(mongoengine.NotUniqueError, author2.save)

The second test fails with the following error : "AssertionError: 
NotUniqueError not raised by save"


It's very strange. After some tests, I realized that the objects of the 
second function, are created with a duplicate key :
> db.author.find()
{ "_id" : ObjectId("530c96b7893e2808f8435e49"), "name" : "Peguy", 
"first_name" : "Charles" }
{ "_id" : ObjectId("530c96b7893e2808f8435e4a"), "name" : "Peguy", 
"first_name" : "Charles" }

I read the docs, this should work. StringField inherits from BaseField and 
should accept unique_with parameter.

Any idea ?


-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dc7a6a09-7540-448f-a412-016cca0dc146%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Tastypie-mongoengine it is possible to filter

2013-12-20 Thread Dominik Cygalski
Hi,

I have exactly the same problem and I cannot find any solution.
Have you solved it?

On Thursday, 30 May 2013 12:21:39 UTC+2, Hélio Miranda wrote:
>
> I still can not solve my problem.
> I'm a little lost not knowing what to do ... I do not know what's wrong?
>
> Nobody can help me?
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4efe0279-3cb9-4a2c-aff2-4a0599b03b03%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Setting up django with mongoengine on windows7

2013-06-27 Thread Dave Francois
So I am trying to set mongo-engine as django's back-end and am having no 
luck :/ so if someone can point me in the direction of a really good guide 
to follow or can walk through setup with me that would be greatly 
appreciated 

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Mongoengine delete file gridfs

2013-06-21 Thread Hélio Miranda


I am using mongoengine to insert images in mongodb's GridFS. Insert 
everything is ok, but I now want to delete, and I'm not getting. I am using 
version 0.8.2 and I'm mongoengine to do so:

class Animal(Document):

 genus = StringField()
 family = StringField()
 photo = FileField()

marmot = Animal(genus='Marmota')

marmot.photo.delete()

Only he did not delete anything or gives error. What am I doing wrong? 
Someone can help me?

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Django-Tastypie with mongoengine problem in uploading images to GridFS

2013-06-19 Thread Hélio Miranda
Hi!
I have an application (Django-Tastypie-mongoengine) in which I am uploading 
images to GridFS. With the previous version of tastypie and mongoengine was 
working properly. As I was doing the following to upload:
*def upload (request, id):*
* Movie.objects movie = (id = id)*
*   *
* if request.method == 'POST':*
* my_painting = Movie (id = id)*
*   *
* files = []*
* request.FILES.getlist for f in ('file'):*
*mf = mongoengine.fields.GridFSProxy ()*
*mf.put (f, filename = f.name, legend = 'Hi')*
*files.append (mf)*
*my_painting.MovieCover = files*
* my_painting.save ()*
*
*
* return render_to_response ('upload.html', {},*
*   context_instance = RequestContext (request))
*

The problem is that now I updated to the latest versions, and when I upload 
the images, it deletes all my data, leaving only the images.
Does anyone know why?
What I have to change to get working properly?

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Tastypie-mongoengine it is possible to filter

2013-05-30 Thread Hélio Miranda
I still can not solve my problem.
I'm a little lost not knowing what to do ... I do not know what's wrong?

Nobody can help me?

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Tastypie-mongoengine it is possible to filter

2013-05-29 Thread Hélio Miranda
I am using in my application Tastypie-mongoengine, and was trying to do a 
filter on a field with ReferenceListField, is this possible?

Is that here: 
http://django-tastypie-mongoengine.readthedocs.org/en/latest/usage.html
I find nothing

I was trying to use it in my class goal:
filtering = {
 'PlayerClub': ALL_WITH_RELATIONS
}

But without any success.
I wonder if it is possible to make a filter on a field with 
ReferenceListField?

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django - Tastypie and mongoengine

2013-05-24 Thread Hélio Miranda
Hi!
Has anyone used Tastypie and mongoengine for an application in django and 
mongodb?

It's just that I have a problem and needed help.
I'm having trouble doing the many to many relationships.

If someone has already done something with tastypie mongoengine and tell me 
to put my doubts.

thank you

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Retrieving images from GridFS using django-tastypie-mongoengine

2013-05-16 Thread Hélio Miranda
But then so was not save in mongodb but in a folder on the server right?
And then as these associated files to records that are in mongodb?

And I'm not using Models, I am using as mongoengine:

*class Movie(mongoengine.Document):*
*MovieTitle = StringField(max_length=100, required=False)*
*MovieCover = FileField()*
*...*

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Retrieving images from GridFS using django-tastypie-mongoengine

2013-05-16 Thread Hélio Miranda
But then so was not save in mongodb but in a folder on the server right?
And then as these associated files to records that are in mongodb?

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Retrieving images from GridFS using django-tastypie-mongoengine

2013-05-15 Thread Ryan Nowakowski
On Thu, May 09, 2013 at 01:50:18AM -0700, Hélio Miranda wrote:
> No, I'm not using GridFSStorage.
> 
> I was just using mongoengine, with FileField field.
> 
> To get the image have to use GridFSStorage?
> How to use it?
> 

GridFSStorage[1] is a Django storage backend[2].  You can override the
default storage backend for FileField[3] to use GridFSStorage[4] or set the
default storage for all FileFields to be GridFSStorage.

[1] http://docs.mongoengine.org/en/latest/django.html#storage
[2] https://docs.djangoproject.com/en/1.5/ref/files/storage/
[3] 
https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FileField.storage
[4] https://docs.djangoproject.com/en/dev/topics/files/#file-storage

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Retrieving images from GridFS using django-tastypie-mongoengine

2013-05-09 Thread Hélio Miranda
No, I'm not using GridFSStorage.

I was just using mongoengine, with FileField field.

To get the image have to use GridFSStorage?
How to use it?

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Retrieving images from GridFS using django-tastypie-mongoengine

2013-05-08 Thread Ryan Nowakowski
On Wed, May 08, 2013 at 04:16:33AM -0700, Hélio Miranda wrote:
> I have a project in Django, and I'm using mongoengine to save images into a 
> Mongo database using GridFS.
> 
> All ok so far, but the problem is... when trying to retrieve the images via 
> http request, with a REST API made with django-tastypie-mongoengine, I get 
> back a json object like this:
> 
> {"file": "", "id": 
> "516ed7cf56ba7d01eb09f524", "resource_uri": 
> "/api/v1/movie/516ed7cf56ba7d01eb09f524/"}
> 
> Does anybody know how could I get the file from GridFS via http request?

Are you using mongoengine's GridFSStorage?

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Retrieving images from GridFS using django-tastypie-mongoengine

2013-05-08 Thread Hélio Miranda


I have a project in Django, and I'm using mongoengine to save images into a 
Mongo database using GridFS.

All ok so far, but the problem is... when trying to retrieve the images via 
http request, with a REST API made with django-tastypie-mongoengine, I get 
back a json object like this:

{"file": "", "id": 
"516ed7cf56ba7d01eb09f524", "resource_uri": 
"/api/v1/movie/516ed7cf56ba7d01eb09f524/"}

Does anybody know how could I get the file from GridFS via http request?

Thanks!

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to config my django project to use tastypie and mongoengine

2012-11-26 Thread carlos
well mongodb actually no run en django core, but exist other alternative
https://github.com/django-nonrel/django-nonrel   and
http://django-mongodb.org/

Cheers

On Sun, Nov 25, 2012 at 3:19 AM, Chanh Le  wrote:

> In the settings.py
> import mongoengine
> mongoengine.connect('cooking')
> AUTHENTICATION_BACKENDS = (
> 'mongoengine.django.auth.MongoEngineBackend',
> )
> SESSION_ENGINE = 'mongoengine.django.sessions'
>
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
>
> # Uncomment the next line for simple clickjacking protection:
> # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
> )
>
> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> # Uncomment the next line to enable the admin:
> 'django.contrib.admin',
> # Uncomment the next line to enable admin documentation:
> # 'django.contrib.admindocs',
> 'tastypie',
> 'tastypie_mongoengine',
> 'django.contrib.sessions',
> 'api',
> )
>
> But when run syncdb it has error
>  django.core.exceptions.ImproperlyConfigured: settings.DATABASES is
> improperly configured. Please supply the ENGINE value.
> How to config this correct?
>
> --
> 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/-/tsety0NmZMsJ.
> 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
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.



How to config my django project to use tastypie and mongoengine

2012-11-25 Thread Chanh Le
In the settings.py
import mongoengine
mongoengine.connect('cooking')
AUTHENTICATION_BACKENDS = (
'mongoengine.django.auth.MongoEngineBackend',
)
SESSION_ENGINE = 'mongoengine.django.sessions'


MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',

# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'tastypie',
'tastypie_mongoengine',
'django.contrib.sessions',
'api',
)

But when run syncdb it has error
 django.core.exceptions.ImproperlyConfigured: settings.DATABASES is 
improperly configured. Please supply the ENGINE value.
How to config this correct?

-- 
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/-/tsety0NmZMsJ.
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.

# Django settings for socialcooking project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_em...@example.com'),
)

MANAGERS = ADMINS


import mongoengine
mongoengine.connect('cooking')
AUTHENTICATION_BACKENDS = (
'mongoengine.django.auth.MongoEngineBackend',
)
SESSION_ENGINE = 'mongoengine.django.sessions'



#DATABASES = {
#'default': {
#'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
#'NAME': '', # Or path to database file if using sqlite3.
#'USER': '', # Not used with sqlite3.
#'PASSWORD': '', # Not used with sqlite3.
#'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
#'PORT': '', # Set to empty string for default. Not used with sqlite3.
#}
#}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/";, "http://example.com/media/";
MEDIA_URL = ''

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/";
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use ab