Re: Trouble with Django in production server.

2014-03-02 Thread Omar Acevedo
I have inside a file called .bashrc,
source /home/userName/.env/env/bin/active,
which makes me be in in a virtual environment already, no?
It has a (env) to the left all the time.
I presume that that is "activating virtualenv to run the server", right?
(:


On Sun, Mar 2, 2014 at 7:19 PM, Camilo Torres wrote:

> You also should be activating your virtualenv to run the server.
>
>
> On Saturday, March 1, 2014 8:46:10 PM UTC-4:30, jondbaker wrote:
>
>> Instead of hard-coding paths, check out os.path, os.abspath and os.sep
>> (and the rest of the os module) for such needs. I usually declare a
>> PROJECT_ROOT var at the top of my settings.py using the aforementioned os
>> module, and then hang paths (like your db path) off of that instead of
>> building each path individually.
>>
>> Glad you figured it out.
>>
>> Sent from my iPhone
>>
>> On Mar 1, 2014, at 5:41 PM, Omar Acevedo  wrote:
>>
>> To see if it worked, and yes it did!
>> So, I'm just having trouble with the paths.
>> I'm using a virtual environment.
>> So I guess I'll have to deal with the paths.
>> Thank you a lot anyways!!! :)
>>
>>
>> On Sat, Mar 1, 2014 at 8:39 PM, Omar Acevedo  wrote:
>>
>>> I explicitly wrote '/home/catacafe/.env/env/lib/python2.7/db.sqlite3'
>>> in the NAME option of the DATABASES dictionary.
>>>
>>
>>  --
>> 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 post to this group, send email to django...@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/CAH_X0gMnjh%2BOy5AQC2rw_LtKEjnWU-
>> YVY_yBH3AzTMoSP%2BCiXw%40mail.gmail.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>  --
> 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/VXpy867egD8/unsubscribe.
> To unsubscribe from this group and all its topics, 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/649003b5-d9c0-40db-ab4d-eefff7df579c%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAH_X0gM1QOcRb7qaUdNAMutvzTL473xq_GmAj4G3H4RmFw__Pw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Using inlines on a one to many but not seeing "add another" link

2014-03-02 Thread Dennis Marwood
I tried deleting the db and running syncdb again (even though that will not 
be a viable fix) and this issue was still present.

Could you explain why this problem appeared and / or how to fix this issue? 
Did I miss something in the upgrade process? The docs just say to use pip 
and check the release notes.

Thank you :)

On Sunday, 2 March 2014 15:40:44 UTC-8, Camilo Torres wrote:
>
> On Saturday, 1 March 2014 15:53:41 UTC-8, Dennis Marwood wrote:
>>
>> Hello. 
>> Here are my models and admin.py  dpaste.de 
>> And here is the what I am referring to 
>> https://docs.djangoproject.com/en/1.6/intro/tutorial02/#customize-the-admin-form
>> But I my not seeing the link to add another. 
>>
> On Sunday, March 2, 2014 5:27:17 PM UTC-4:30, Dennis Marwood wrote:
>>
>> The only difference between the two apps that I can see is that I created 
>> the old one w/ django 1.4.
>>
>
>  That is a really _big_ difference, and surely is the cause for your error 
> :)
>
> Regards,
> Camilo
>

-- 
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/3dd49c4e-ec2e-444e-9aa4-a799e2081683%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Multiwidget internal widgets ID overridden bug?

2014-03-02 Thread Russell Keith-Magee
On Sun, Mar 2, 2014 at 10:29 PM, Sai Prasanna wrote:

> I saw that the render method in django.form.widgets. multiwidget class
> changes the id of internal widgets .Shouldn't it set internal widget ids if
> they are specified in attrs of widgets passed to the init.
>
Hi Sai,

If I'm understanding you correctly, maybe :-)

I can certainly understand your position that if you're manually specifying
an ID for a widget, then Django should use it in preference to generating
it's own. From a quick inspection, normal "single" widgets certainly take
this approach.

The behaviour you're seeing in MultiWidget looks like it's an artefact of
making it easy to identify the individual subwidgets. If you pass in an id
at the Field level, or as an ID attribute of the *multiwidget*, it will be
preserved, and the sub widgets will get _0, _1... prefixes as appropriate.

I can see your point that if you're manually specifying the widget IDs for
the subwidgets, they should be preserved.

If you worked up a full patch for this (with tests, and probably some
clarifying documentation), I imagine it would probably be committed.

My bigger question to you would be why you are specifying IDs at the widget
level in the first place. To me, this is a flag that you're possibly being
a little *too* specific in your code. If you're hard-coding (and requiring)
a specific ID, it means your code is really only going to be useful in one
particular place and time.

You may well have a good reason for needing a specific ID for subwidgets,
and if you do, that's fine. However, if you're just fixing IDs because you
think you have to, I'd suggest taking a closer look at ways of making your
code more reusable (e.g., by using class specifiers instead of IDs).

Yours,
Russ Magee %-)

-- 
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/CAJxq84-qZN_M-GswG8qCtVwXMQnMJ3Dc7%2Bi2%3DBGoDFqniHuMpw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Using inlines on a one to many but not seeing "add another" link

2014-03-02 Thread Camilo Torres
On Saturday, 1 March 2014 15:53:41 UTC-8, Dennis Marwood wrote:
>
> Hello. 
> Here are my models and admin.py  dpaste.de 
> And here is the what I am referring to 
> https://docs.djangoproject.com/en/1.6/intro/tutorial02/#customize-the-admin-form
> But I my not seeing the link to add another. 
>
On Sunday, March 2, 2014 5:27:17 PM UTC-4:30, Dennis Marwood wrote:
>
> The only difference between the two apps that I can see is that I created 
> the old one w/ django 1.4.
>

 That is a really _big_ difference, and surely is the cause for your error 
:)

Regards,
Camilo

-- 
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/f1d72c1f-afed-4181-a287-cd4ba74ced18%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django - commenting app for all other apps

2014-03-02 Thread Camilo Torres
On Sunday, March 2, 2014 5:30:01 AM UTC-4:30, Robin Lery wrote:
>
> I have an app for forum. It has three classes *Tag*, *Question* and 
> *Answer*.
>
> I also want to have comments for *Question*, *Answers* and also for *other 
> parts* of my apps. What is the best way to achieve this? I mean, what is 
> the right way to design the django models for this use case? Do I have to 
> use *content types* for this?
>

You can use multiple table inheritance. See this question and study how a 
similar case like yours was solved in another domain, but with the same 
need for comments:

https://groups.google.com/forum/#!topic/django-users/KOebQtRnYt0

Regards,
Camilo

-- 
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/fdddbd07-f9eb-4eea-8e66-16118e111954%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: about installed_apps and manage.py ( no module named oztrend)

2014-03-02 Thread Camilo Torres
On Sunday, March 2, 2014 12:35:58 PM UTC-4:30, 董健 wrote:
>
> My error is something like ImportError: no module named oztrend. 
> I know that apps in the list of installed_apps can be searched in 
> python/lib/site-packages or the app directory. however, i cannot figure out 
> the search order. now, python/lib/site-packages are searched in the first 
> place and the error above appears.
> the second question is the location of manage.py. it seems that the loc of 
> manage.py is related to the app directory.Can someone give me some 
> instructions or some related articles?
> thanks in advance.
>

You should provide more information, like:

* The directory structure of your project 
* The stack trace for the error
* How are you running your application
* How do you installed this oztrend module or where do you put it

Here you can see information about the location and usage of manage.py:

* https://docs.djangoproject.com/en/1.6/intro/tutorial01/

-- 
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/23b6226e-ec9a-46e7-93e1-e769f4d7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Trouble with Django in production server.

2014-03-02 Thread Camilo Torres
You also should be activating your virtualenv to run the server.

On Saturday, March 1, 2014 8:46:10 PM UTC-4:30, jondbaker wrote:
>
> Instead of hard-coding paths, check out os.path, os.abspath and os.sep 
> (and the rest of the os module) for such needs. I usually declare a 
> PROJECT_ROOT var at the top of my settings.py using the aforementioned os 
> module, and then hang paths (like your db path) off of that instead of 
> building each path individually.
>
> Glad you figured it out.
>
> Sent from my iPhone
>
> On Mar 1, 2014, at 5:41 PM, Omar Acevedo > 
> wrote:
>
> To see if it worked, and yes it did!
> So, I'm just having trouble with the paths.
> I'm using a virtual environment.
> So I guess I'll have to deal with the paths.
> Thank you a lot anyways!!! :)
>
>
> On Sat, Mar 1, 2014 at 8:39 PM, Omar Acevedo 
> > wrote:
>
>> I explicitly wrote '/home/catacafe/.env/env/lib/python2.7/db.sqlite3' in 
>> the NAME option of the DATABASES dictionary.
>>
>
>  -- 
> 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 post to this group, send email to django...@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/CAH_X0gMnjh%2BOy5AQC2rw_LtKEjnWU-YVY_yBH3AzTMoSP%2BCiXw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
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/649003b5-d9c0-40db-ab4d-eefff7df579c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: "No such table" error.

2014-03-02 Thread Camilo Torres

On Saturday, March 1, 2014 3:29:01 PM UTC-4:30, Omar Acevedo wrote:
>
> Hello, I'm having an issue in/with Django, which is on a shared hosting, 
> and I'm using virtualenv and fastcgi.  (<- saying this, just in case it 
> helps in something)
>
> I'm getting
> "OperationalError at /admin/
> no such table: auth_user" 
> after entering my credentials (username & pw) that were set when asked 
> after running the syncdb.
> Yes, I created a project (django-admin.py startproject the_project),  then 
> ran python manage.py syncdb.
> So it's supposed (which it says it does) to create the tables for the 
> admin, but still, I'm getting that error when going to the admin through 
> mydomain.com/admin.
>
> I'm a first-timer hosting a django app, so, what else I'm supposed to 
> know, to do?  
>

May be you are using a different settings file when you ran the command 
than when you deploy the application.

-- 
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/c14a45af-7bd8-40b0-8faa-2ec7bb7bebe4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Using inlines on a one to many but not seeing "add another" link

2014-03-02 Thread Dennis Marwood
I went back to my original polls app and the link is not there either. 
So I spun up a new project and created the polls app again and found the 
link there. 

The only difference between the two apps that I can see is that I created 
the old one w/ django 1.4.

On Saturday, 1 March 2014 15:53:41 UTC-8, Dennis Marwood wrote:
>
> Hello. 
> Here are my models and admin.py  dpaste.de 
> And here is the what I am referring to 
> https://docs.djangoproject.com/en/1.6/intro/tutorial02/#customize-the-admin-form
> But I my not seeing the link to add another. 
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/80381a10-8b18-4b10-94a5-1f069b9409c9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Review needed

2014-03-02 Thread Kakar Nyori
Hello,
This may be long, but I really need your help. I have a class *Asset*, 
which is the *base class* of another *classes *(like *Photo, Question, 
Video etc.*) Basically its a *Multiple Table Inheritance*. I need this to 
get all the post or all the *objects* of the user. And it does what I want. 
But I saw that, many were against *Multiple Table Inheritance, *or if not 
they discouraged MTI. So, I really need to know that, *how much will it 
matter*? Or is there any other way to achieve it. To get all the objects of 
a *User*? Please help me decide what to do. If I am not clear, please ask 
me. I will really appreciate if anyone would guide me through this.

Thank you.

*This are my models:*


class Asset(models.Model):
user = models.ForeignKey(User, related_name = "user_objects")
likes = models.ManyToManyField(User, through="Like", 
related_name="Liked_user")
comments = models.ManyToManyField(User, through="Comment", 
related_name="Commented_user")
timestamp = models.DateTimeField(auto_now = True, auto_now_add= False)
updated = models.DateTimeField(auto_now = False, auto_now_add = True)

class Meta:
ordering = ['-timestamp']

def __unicode__(self):
return self.__class__.__name__

class Like(models.Model):
asset = models.ForeignKey(Asset)
liked_by = models.ForeignKey(User)
liked_time = models.DateTimeField(auto_now = True, auto_now_add = False)

def __unicode__(self):
return "%s likes %s" % (self.liked_by, self.asset)

class Comment(models.Model):
asset = models.ForeignKey(Asset)
comment_by = models.ForeignKey(User)
liked_time = models.DateTimeField(auto_now = True, auto_now_add = False)

def __unicode__(self):
return "%s likes %s" % (self.comment_by, self.asset)

def get_upload_file_name(instance, filename):
return "uploaded_files/%s_%s" %(str(time()).replace('.','_'), filename)

class Album(Asset):
title = models.CharField(max_length=200)
description = models.TextField()

def __unicode__(self):
return self.__class__.__name__


class Picture(Asset):
description = models.TextField()
image = models.ImageField(upload_to=get_upload_file_name)
album = models.ForeignKey(Album, null=True, blank=True, default = None)

def __unicode__(self):
return self.__class__.__name__

class BackgroundImage(Picture):
pass

class ProfilePicture(Picture):
pass

class Tag(models.Model):
title = models.CharField(max_length=40)
description = models.TextField()

def __unicode__(self):
return self.title

class Question(Asset):
title = models.CharField(max_length=200)
description = models.TextField()
tags = models.ManyToManyField(Tag)

def __unicode__(self):
return self.title

class Answer(Asset):
description = models.TextField()
question = models.ForeignKey(Question)

def __unicode__(self):
return self.description

-- 
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/871d20b8-17a3-4ed4-bb8e-3c0befb5121f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


about installed_apps and manage.py ( no module named oztrend)

2014-03-02 Thread 董健
My error is something like ImportError: no module named oztrend. 
I know that apps in the list of installed_apps can be searched in 
python/lib/site-packages or the app directory. however, i cannot figure out 
the search order. now, python/lib/site-packages are searched in the first 
place and the error above appears.
the second question is the location of manage.py. it seems that the loc of 
manage.py is related to the app directory.Can someone give me some 
instructions or some related articles?
thanks in advance.

-- 
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/5a83fb6e-c130-407a-bd53-379283dc60a4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Multiwidget internal widgets ID overridden bug?

2014-03-02 Thread Sai Prasanna
I saw that the render method in django.form.widgets. multiwidget class
changes the id of internal widgets .Shouldn't it set internal widget ids if
they are specified in attrs of widgets passed to the init.

-- 
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/CAHcjWa7oF%2BVApqJ4E9oz7hDAR3AM6bvUzYEjMuuc6CGCHtWOkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: memcached and redis

2014-03-02 Thread Robin Lery
Hello,
Its no bother. Thank you! I have learnt a lot from you guyz!


On Sun, Mar 2, 2014 at 5:27 PM, Andreas Kuhne wrote:

> Hi,
>
> I really don't know if they exist. Check redis.io, you should be able to
> see them there.
>
> Regards,
>
> Andréas
>
>
> 2014-03-01 21:48 GMT+01:00 Robin Lery :
>
>> Ok, I think I get it now. Thank you so much! Just one more question
>> though, does redis has feature similar to *getidentifiable()* and 
>> *putifuntouched()
>> *like memcache, I think these are for consistency?
>>
>>
>> On Sun, Mar 2, 2014 at 2:09 AM, Andreas Kuhne > > wrote:
>>
>>> Ok,
>>>
>>> Redis and Memcache really solve the same problems. The main difference
>>> is that you can use redis as a session cache for django (save the session
>>> objects to memory instead of the database), which I haven't found a
>>> solution for memcache yet. Also redis CAN be persisted (saved to disk), if
>>> you setup your own redis server.
>>>
>>> But otherwise, you can use both memcache and redis for your cache.
>>> Examples where a cache can be useful:
>>> 1. You want to do a complex database query that takes a long time to
>>> run, but doesn't update often. Just cache the results and use the result if
>>> it is present.
>>> 2. You can also cache the result of a view. If the view takes a long
>>> time to render AND is the same for all users, then cache the entire view
>>> result.
>>> 3. There is also the possibility to  create portions of a template and
>>> cache just those portions.
>>>
>>> Thats what I can think of off the top of my head. You can find more
>>> information about it here:
>>> https://docs.djangoproject.com/en/dev/topics/cache/
>>> http://memcached.org/
>>> http://redis.io/
>>>
>>> The main thing to remember is that both memcache and redis are in memory
>>> databases (key-value store) (even though redis can be persisted) and if the
>>> server is rebooted, then the cache is empty. Also being a in memory
>>> database means that getting information back from the key-value store is
>>> more or less instantanious especially if you compare to a standard sql
>>> database.
>>>
>>> Regards,
>>>
>>> Andréas
>>>
>>>
>>> 2014-03-01 21:27 GMT+01:00 Robin Lery :
>>>
  Use cases with memcached and redis please.


 On Sun, Mar 2, 2014 at 1:45 AM, Andreas Kuhne <
 andreas.ku...@suitopia.com> wrote:

> Hi again,
>
> Do you mean use cases with redis and memcache or with S3?
>
> Regards,
>
> Andréas
>
> 2014-03-01 21:00 GMT+01:00 Robin Lery :
>
>>  Hello,
>> Thank you for your answer. Would you please elaborate a little more
>> about the use cases with these? And can I use them together?
>>
>> Thank you.
>>
>>
>> On Sun, Mar 2, 2014 at 1:01 AM, Andreas Kuhne <
>> andreas.ku...@suitopia.com> wrote:
>>
>>> Hi,
>>>
>>> In response to your question about memcache and redis, they are
>>> extremely useful, if you use them correctly. For example if you are
>>> generating a query to your database that takes 1 second to finish, and 
>>> you
>>> cache the results in memcache or redis, then you would be able to get 
>>> the
>>> second request down to 50 ms instead. Thats the difference in response
>>> time. Redis and memcache are in memory databases and are extremely fast!
>>>
>>> Regarding your second question, if you need to store alot of
>>> pictures and videos, I would use Amazon S3 with the django storages 
>>> backend
>>> for S3.
>>>
>>> Regards,
>>>
>>> Andréas
>>>
>>>
>>> 2014-03-01 17:28 GMT+01:00 Robin Lery :
>>>
  Hello,
 Another noob question. Please bear with me. I am really very
 confused between memcached and redis. I know they both are used for
 caching. But I don't know how much does they help. And lastly, I would 
 like
 know what would you use for a site with users uploaded pictures and 
 videos
 too? I hope I was clear. If not please ask. Your help and guidance 
 will be
 very much appreciated.

 Thank you.
 Robin.

 --
 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/CA%2B4-nGqoYH24%2BSLzM8Jx3dN_xiPFYpZ90-gqfRNVpcWUEK%3DVsw%40mail.gmail.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.

>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django

Re: memcached and redis

2014-03-02 Thread Andreas Kuhne
Hi,

I really don't know if they exist. Check redis.io, you should be able to
see them there.

Regards,

Andréas


2014-03-01 21:48 GMT+01:00 Robin Lery :

> Ok, I think I get it now. Thank you so much! Just one more question
> though, does redis has feature similar to *getidentifiable()* and 
> *putifuntouched()
> *like memcache, I think these are for consistency?
>
>
> On Sun, Mar 2, 2014 at 2:09 AM, Andreas Kuhne 
> wrote:
>
>> Ok,
>>
>> Redis and Memcache really solve the same problems. The main difference is
>> that you can use redis as a session cache for django (save the session
>> objects to memory instead of the database), which I haven't found a
>> solution for memcache yet. Also redis CAN be persisted (saved to disk), if
>> you setup your own redis server.
>>
>> But otherwise, you can use both memcache and redis for your cache.
>> Examples where a cache can be useful:
>> 1. You want to do a complex database query that takes a long time to run,
>> but doesn't update often. Just cache the results and use the result if it
>> is present.
>> 2. You can also cache the result of a view. If the view takes a long time
>> to render AND is the same for all users, then cache the entire view result.
>> 3. There is also the possibility to  create portions of a template and
>> cache just those portions.
>>
>> Thats what I can think of off the top of my head. You can find more
>> information about it here:
>> https://docs.djangoproject.com/en/dev/topics/cache/
>> http://memcached.org/
>> http://redis.io/
>>
>> The main thing to remember is that both memcache and redis are in memory
>> databases (key-value store) (even though redis can be persisted) and if the
>> server is rebooted, then the cache is empty. Also being a in memory
>> database means that getting information back from the key-value store is
>> more or less instantanious especially if you compare to a standard sql
>> database.
>>
>> Regards,
>>
>> Andréas
>>
>>
>> 2014-03-01 21:27 GMT+01:00 Robin Lery :
>>
>>>  Use cases with memcached and redis please.
>>>
>>>
>>> On Sun, Mar 2, 2014 at 1:45 AM, Andreas Kuhne <
>>> andreas.ku...@suitopia.com> wrote:
>>>
 Hi again,

 Do you mean use cases with redis and memcache or with S3?

 Regards,

 Andréas

 2014-03-01 21:00 GMT+01:00 Robin Lery :

>  Hello,
> Thank you for your answer. Would you please elaborate a little more
> about the use cases with these? And can I use them together?
>
> Thank you.
>
>
> On Sun, Mar 2, 2014 at 1:01 AM, Andreas Kuhne <
> andreas.ku...@suitopia.com> wrote:
>
>> Hi,
>>
>> In response to your question about memcache and redis, they are
>> extremely useful, if you use them correctly. For example if you are
>> generating a query to your database that takes 1 second to finish, and 
>> you
>> cache the results in memcache or redis, then you would be able to get the
>> second request down to 50 ms instead. Thats the difference in response
>> time. Redis and memcache are in memory databases and are extremely fast!
>>
>> Regarding your second question, if you need to store alot of pictures
>> and videos, I would use Amazon S3 with the django storages backend for 
>> S3.
>>
>> Regards,
>>
>> Andréas
>>
>>
>> 2014-03-01 17:28 GMT+01:00 Robin Lery :
>>
>>>  Hello,
>>> Another noob question. Please bear with me. I am really very
>>> confused between memcached and redis. I know they both are used for
>>> caching. But I don't know how much does they help. And lastly, I would 
>>> like
>>> know what would you use for a site with users uploaded pictures and 
>>> videos
>>> too? I hope I was clear. If not please ask. Your help and guidance will 
>>> be
>>> very much appreciated.
>>>
>>> Thank you.
>>> Robin.
>>>
>>> --
>>> 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/CA%2B4-nGqoYH24%2BSLzM8Jx3dN_xiPFYpZ90-gqfRNVpcWUEK%3DVsw%40mail.gmail.com
>>> .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
>> 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 - commenting app for all other apps

2014-03-02 Thread Robin Lery
I have an app for forum. It has three classes *Tag*, *Question* and *Answer*
.

*models*:

class Tag(models.Model):
tag_name = models.CharField(max_length=100)
timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
updated = models.DateTimeField(auto_now_add=True, auto_now=False)
description = models.TextField()

def __unicode__(self):
return smart_unicode(self.tag_name)

class Question(models.Model):
short_description = models.CharField(max_length=250)
description = models.TextField()
asked_by = models.ForeignKey(User)
tags = models.ManyToManyField(Tag)
timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
updated = models.DateTimeField(auto_now_add=True, auto_now=False)

def __unicode__(self):
return smart_unicode(self.short_description)

class Answer(models.Model):
description = models.TextField()
for_question = models.ForeignKey(Question)
timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
updated = models.DateTimeField(auto_now_add=True, auto_now=False)

def __unicode__(self):
return smart_unicode(self.description)

I also want to have comments for *Question*, *Answers* and also for *other
parts* of my apps. What is the best way to achieve this? I mean, what is
the right way to design the django models for this use case? Do I have to
use *content types* for this? Please guide me how to achieve the above
mentioned. Your help will be much appreciated. 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B4-nGrBVHz9TKr_cPHfyw-488rohdp8bdMV7H844NkLeRytKA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: memcached and redis

2014-03-02 Thread Robin Lery
Thank you Andy and Russel! I guess I know a lot about those two cache
methods.


On Sun, Mar 2, 2014 at 5:23 AM, Andy McKay  wrote:

> On Sat, Mar 1, 2014 at 12:39 PM, Andreas Kuhne  > wrote:
>
>> The main difference is that you can use redis as a session cache for
>> django (save the session objects to memory instead of the database), which
>> I haven't found a solution for memcache yet.
>>
>
> Memcache works just fine as a session backend:
>
>
> https://docs.djangoproject.com/en/dev/topics/http/sessions/#using-cached-sessions
>
> Andy
>
>  --
> 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/CAOjXX8aCOZXQcVkb%3Dfk%2BcJtgphAJdY%2BrUAC7aDVnMEDWFq2Vgg%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CA%2B4-nGrhMyEVcO1A59gFdKmxDeag%3D10He0tme%3D62fnsCFLdq%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.