runserver => production mode

2014-07-03 Thread Jun Tanaka
Debug tool bar + runserver is very handy. But production environment have a root_path. Say, such as IPaddress/simle_project. Now we change the root_path in url.py each time for prodction. Is there any better way to resolve this problem? Two possible solutions: 1.Runserver with the root_

Re: Mysql connections after started django app

2014-07-03 Thread cercatrova2
On 04/07/14 05:04, Zemian Deng wrote: Hi, In my django settings.py I have set CONN_MAX_AGE=0 to use with MySQL DB, which I understood as closing conn after each request. However when I start a simple "mysite" tutorial with

Re: "ResourceWarning: unclosed" error using mysql-connector-python

2014-07-03 Thread cercatrova2
On 04/07/14 05:09, Zemian Deng wrote: Hum... I am surprised that no one has experienced this warning msg yet, or maybe I can't catch anyone to reply. For those are curious, I do now see mysql-connector-python 1.2.2 is availabl

Re: "ResourceWarning: unclosed" error using mysql-connector-python

2014-07-03 Thread Zemian Deng
Hum... I am surprised that no one has experienced this warning msg yet, or maybe I can't catch anyone to reply. For those are curious, I do now see mysql-connector-python 1.2.2 is available, and upgrading to this version got rid off these warnings. On Thursday, June 12, 2014 11:24:40 PM UTC-4,

Mysql connections after started django app

2014-07-03 Thread Zemian Deng
Hi, In my django settings.py I have set CONN_MAX_AGE=0 to use with MySQL DB, which I understood as closing conn after each request. However when I start a simple "mysite" tutorial with "python manage.py runserver", I see immediately 3 connections in mysql that will not close but in Sleep mode.

Re: Time Zone Problem when following on tutorial

2014-07-03 Thread Mike Dewhirst
On 3/07/2014 11:57 PM, Jerry Wu wrote: Mike, Sorry for the late reply. Your explanation about "time is constant" makes sense to me. But I still didn't know what to do with time setting following the tutorial. One day I'll do some experiments and *really* understand how it works. My variables

Re: Unicode Str error [Beginner question]

2014-07-03 Thread Jorge Andrés Vergara Ebratt
Def __str__ is a comment, you can ommit it On Jul 3, 2014 2:37 PM, "Lian Tombing" wrote: > When I tried to implement the example, > > class Poll(models.Model): > # ... > def __unicode__(self): # Python 3: def __str__(self): > return self.question > > I get the error, > > Tab erro

Re: Unicode Str error [Beginner question]

2014-07-03 Thread José Javier Castro Matamoros
Could you please put all the code of the model. On Thu, Jul 3, 2014 at 1:08 PM, Lian Tombing wrote: > When I tried to implement the example, > > class Poll(models.Model): > # ... > def __unicode__(self): # Python 3: def __str__(self): > return self.question > > I get the error, >

ModelForm with ContentType not saving to Database

2014-07-03 Thread Muhammad
Hi All, I have been stuck on this for the last few hours and nothing seems to work. I would greatly appreciate your help. I created a Comment model (which uses ContentType) so that I can use it when any model that I want to. I also created a CommentForm() ModelForm instance for the Comment m

Unicode Str error [Beginner question]

2014-07-03 Thread Lian Tombing
When I tried to implement the example, class Poll(models.Model): # ... def __unicode__(self): # Python 3: def __str__(self): return self.question I get the error, Tab error: inconsistent use of tabs and spaces. If I put def __str__ (self): in the same tab as class, it does no

Re: how to saven models dynamically inputted by user in form

2014-07-03 Thread Sandeep kaur
On Wed, Jul 2, 2014 at 11:03 AM, Aashita Dutta wrote: > > here is my model- > from django.db import models > import useraccounts > from librehatti.catalog.models import * > from django.contrib.auth.models import User > > class QuotedOrder(models.Model): > quote_buyer_id = models.ForeignKey(Use

Re: what should be careful for production?

2014-07-03 Thread Helton Alves
I don't know if I understand. but, look here: https://docs.djangoproject.com/en/1.5/ref/settings/#debug I think that is this that you want. 2014-07-03 18:10 GMT+01:00 : > Hello, > > An application works fine with runserver now. And then connected to WSGI. > What else should be done and be car

what should be careful for production?

2014-07-03 Thread jmindview
Hello, An application works fine with runserver now. And then connected to WSGI. What else should be done and be careful for production? And debug mode does not run with WSGI even if debug = True in settings.py. Is that true? Please advice me. -- You received this message because you are s

Re: exclude and filter

2014-07-03 Thread monoBOT
2014-07-03 9:39 GMT+01:00 Pradip Caulagi : > Booking.objects.exclude(id__in = PriorToCheckout.objects.all(). > values_list('confirmation_call__booking__id', flat=True)).count > ​try: Booking.objects.all().exclude(id__in = PriorToCheckout.objects.all(). values_list('confirmation_call__booking__id'

Re: Unit testing - self.assertEqual(login, True)

2014-07-03 Thread Pepsodent Cola
Thanks! I see what I did wrong now. class UserProfileTest(TestCase): # Create User def setUp(self): self.user = *User.objects.create_user*(username='captain', password='america') # Logged in def test_VIEW_USER__Logged_in(self): self.assertTrue(isinstance(self.us

Re: Question about static file serving strategy with S3 and Cloudfront

2014-07-03 Thread Cal Leeming [Simplicity Media Ltd]
Also worth mentioning that django-pipeline does cache busting by adding a random string into the filename, rather than query string, so you may be able to extend on that for your own needs. Cal On Thu, Jul 3, 2014 at 2:29 PM, Scott Anderson wrote: > This is what we do, although we don't use qu

Re: Time Zone Problem when following on tutorial

2014-07-03 Thread Jerry Wu
Mike, Sorry for the late reply. Your explanation about "time is constant" makes sense to me. But I still didn't know what to do with time setting following the tutorial. Anyway, I chose to use Asia/Shanghai instead of fashion code. So far so good. Thank you very much. On Thursday, June 26,

Re: Question about static file serving strategy with S3 and Cloudfront

2014-07-03 Thread Scott Anderson
This is what we do, although we don't use query strings as some network appliances don't respect them with respect to caching. We use a virtual directory instead: //example.com/static//images/blancmange.png Where is obtained like this: $ git log --oneline | wc -l | awk '{ print $1; }' And ng

Re: Unit testing - self.assertEqual(login, True)

2014-07-03 Thread Amim Knabben
duplicated question https://groups.google.com/forum/#!topic/django-users/I4wmYKNMNn8 On Thu, Jul 3, 2014 at 9:09 AM, Pepsodent Cola wrote: > I want to run a unit test for a user logging in but I get error. What am > I doing wrong? > > > from django.test import TestCase > from userprofile.mode

Unit testing - self.assertEqual(login, True)

2014-07-03 Thread Pepsodent Cola
I want to run a unit test for a user logging in but I get error. What am I doing wrong? from django.test import TestCase from userprofile.models import UserProfile from django.contrib.auth.models import User class UserProfileTest(TestCase): # User factory method def create_user(self, u

exclude and filter

2014-07-03 Thread Pradip Caulagi
What am I missing here? I would expect the last query to return (14389 - 2136) records below - >>> Booking.objects.all().count() 14389 >>> Booking.objects.filter(id__in = PriorToCheckout.objects.all().values_list('confirmation_call__booking__id', flat=True)).count() 2136 >>> Booking.objects.