Re: Serving static files from another directory rather than "statics"

2014-07-07 Thread Chen Xu
django-pipline looks good for me at first, and then I realize it copies
both the minified files and the original files (which I dont want). That is
why I wrote my own scripts.

Thanks



On Mon, Jul 7, 2014 at 10:35 PM, carlos  wrote:

> Hi, maybe you need use this third party solution
> http://django-compressor.readthedocs.org/en/latest/
>
> and other is
> https://django-pipeline.readthedocs.org/en/latest/
>
> Cheers
>
>
> On Mon, Jul 7, 2014 at 5:58 PM, Chen Xu  wrote:
>
>> Hi Everyone,
>> I am working on a site, under my project in my local environment, I have
>> a directory called "static" (generated by django just like everyone else's)
>> to server my js and css. I wrote a script which minify all the js and css
>> files and copy them in a directory called "static_min" which is at the same
>> level as "static". When I try to include my css and js files from
>> "static_min", it show url not found.
>>
>> And I tried the followeing:
>> in my settings: I changed the STATICFILES_DIRS as the following:
>>
>> STATIC_ROOT = sys.path[0]
>>
>> STATICFILES_DIRS = (
>> os.path.join(STATIC_ROOT, 'static'),
>> os.path.join(STATIC_ROOT, 'static_min')
>> )
>>
>> I thought doing this will make Django to look for file in both static and
>> static_min, but it did not work.
>>
>>
>> Could someone help.
>>
>> Thanks
>>
>>
>>
>>
>>
>> --
>> ⚡ Chen Xu ⚡
>>
>> --
>> 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/CACac-qZbMcM6%2Bqs9frw1gToBSvbgD2NSaFtdOFrDfxScX%3DiVmg%40mail.gmail.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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAM-7rO28fM3wZmYL85jCXECaiiYnOrHhVv8%3DZSfKVmLV5-ox_Q%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
⚡ Chen Xu ⚡

-- 
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/CACac-qYQ_1t1vrOKtYBM3yZbsDcZ3NN5byVAvyYvkOd-jdavNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django newbie issues

2014-07-07 Thread Lachlan Musicman
If they aren't in settings, then the software would never have worked
(if it needed a DB) :)

You can just open settings.py with a text editor - notepad, wordpad,
gedit, emacs/vim, even word if you want. It's just a text file.

Cheers
L.

On 8 July 2014 14:05, Janelle O'Dea  wrote:
> Again, super helpful. I just have a few more (hopefully not terribly
> obvious) questions: this mechanism specified in settings.py; will I access
> settings.py the same way as manage.py? python settings.py runserver?
>
> If I find the credentials for the database (if they aren't in settings.py, I
> probably don't have them...am I screwed?) how can I get to and dump the db?
>
> On Monday, July 7, 2014 7:30:44 PM UTC-4, Mike Dewhirst wrote:
>>
>> On 8/07/2014 2:22 AM, Janelle O'Dea wrote:
>> > Thank you, Mike. I haven't tried your first option yet, but I will
>> > either today or tomorrow. What kinds of clues would I look for in
>> > settings?
>>
>> Django needs credentials to access the database and there should be a
>> mechanism specified in settings to get them. I don't keep such things
>> directly in my settings because I keep them under version control. But
>> if you had unfettered acccess to my machine you could discover where
>> they are. You say you have the Ubuntu machine in question so you might
>> be able to find them.
>>
>> The fingers crossed part is because the developer might have settled for
>> the Django Admin superuser credentials being the same as for the database.
>>
>> If not, but you do have the database credentials you can dump the db,
>> start another Django project with the same source code and load a new
>> database to gain complete access to everything.
>>
>> Also: any ideas about my first question?
>>
>> No. I'm not a Mac person. But permissions on Macs are (I believe) the
>> same as for Linux/Unix.
>>
>> Good luck
>>
>> Mike
>>
>> >
>> > Everyone: I'm in Naples, Florida. If anyone is in the Southwest Florida
>> > area and wants to try and help, I'll get you a Randy's key lime pie. Or
>> > take you out for seafood. Or something.
>> >
>> > On Sunday, July 6, 2014 7:36:46 PM UTC-4, Janelle O'Dea wrote:
>> >
>> > Hi all,
>> >
>> > I have two separate Django questions.
>> >
>> > One: I am trying to learn how to use Django on my computer (Mac OS,
>> > Mavericks) and was first getting the error "unable to open database"
>> > when running "python manage.py syncdb." To fix it, I followed
>> > instructions from here: https://coderwall.com/p/gl_grw
>> > 
>> > Now, I can't save settings.py. I realize this may have to do with
>> > the advice to change permissions on the page I just linked to; how
>> > can I change them back?
>> > When I run the "python manage.py syncdb" command now, it tells me
>> > there's a syntax error in settings.py. When I try to fix settings.py
>> > and save it, it tells me ERRNO 13 permission denied.
>> > I'm mainly trying to get a feel for Django because I may want to use
>> > it in the near future.
>> >
>> > Two: At my workplace, someone produced a Django app on Ubuntu. The
>> > app is a source database for reporters to view and add to (I work at
>> > a newspaper). The main question: can I get the source information
>> > out of this database so that we can recover it and use it, even if
>> > the original creator of this app/database is not available? He isn't
>> > responding to phone calls or emails, and bosses want me to see if I
>> > can extract the info. I've never worked in Ubuntu before.
>> >
>> > Thanks for any help that anyone can provide.
>> >
>> > --
>> > 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/38f6d8d0-efe2-4739-9e79-bdcd35f2cc7b%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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1bc66d35-aff3-4710-8

Re: SWFL Django users

2014-07-07 Thread Russell Keith-Magee
Hi,

In case you (or anyone else) didn't know about it, people.djangoproject.com
maintains an index of people who declare themselves as Django developers.

https://people.djangoproject.com/us/

If you zoom in on the US:

https://people.djangoproject.com/us/

There's a few people in Florida.

Yours,
Russ Magee %-)



On Tue, Jul 8, 2014 at 12:07 PM, Janelle O'Dea  wrote:

> Anybody in Southwest Florida who uses Django?
>
> --
> 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/ca48e254-7bdb-4665-90f8-337f8e57f96b%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJxq849R3Y6UPQyg5sk%2BXSqFHzoip3COon5dBCrgJBq91SM7Ag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python 3 Usage

2014-07-07 Thread Elena Williams
Hi Richard,

Django has fully supported Python 3 for a while now, see this talk:
http://pyvideo.org/video/2242/porting-django-apps-to-python-3-0

Also IMHO it's less a matter of which users use Python 3 (I'd say it's
likely most serious Python users mix-and-match on a project-to-project
basis, depending on the age of the original code, but use Python 3 where
they can).

I'd say it's a case of which hosting servers are running Python 3 at the
time of deployment.

Often the default version of Python supported by hosts is 2.7 or even 2.6,
so it's a matter of whether the costs outweigh the benefits of installing
and maintaining your own versions of Python 3.

---
Elena :)
@elequ


On Tue, Jul 8, 2014 at 10:17 AM, Timothy W. Cook  wrote:

> I've been using Python 3 with Django for about 8 months.  No real
> problems.  Early on I had to patch a couple of add-ons.
>
>
>
> On Mon, Jul 7, 2014 at 9:10 PM, Richard Eng 
> wrote:
>
>> I was wondering how many Django users have switched to Python 3. Are the
>> majority of users still on Python 2? I'm looking for rough
>> proportion/percentage.
>>
>> I also read that Django and Python 3 have some problems or issues. Is
>> there any truth to this?
>>
>> 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/d2ac4e23-471a-4c11-a16d-54a11b7bef33%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>
> 
> Timothy Cook
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
> MLHIM http://www.mlhim.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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3Xt8gzVQSBUqnyTKm3ij%2BqbV_3YJr5x5XQ8ALrQA4g7cQ%40mail.gmail.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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMRRKVcB%2BNwSUeKQ2C8MTxd16Fh8DXQGXL3fhxNhi0aVtjxbCA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


SWFL Django users

2014-07-07 Thread Janelle O'Dea
Anybody in Southwest Florida who uses Django? 

-- 
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/ca48e254-7bdb-4665-90f8-337f8e57f96b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django newbie issues

2014-07-07 Thread Janelle O'Dea
Again, super helpful. I just have a few more (hopefully not terribly 
obvious) questions: this mechanism specified in settings.py; will I access 
settings.py the same way as manage.py? python settings.py runserver?

If I find the credentials for the database (if they aren't in settings.py, 
I probably don't have them...am I screwed?) how can I get to and dump the 
db?

On Monday, July 7, 2014 7:30:44 PM UTC-4, Mike Dewhirst wrote:
>
> On 8/07/2014 2:22 AM, Janelle O'Dea wrote: 
> > Thank you, Mike. I haven't tried your first option yet, but I will 
> > either today or tomorrow. What kinds of clues would I look for in 
> > settings? 
>
> Django needs credentials to access the database and there should be a 
> mechanism specified in settings to get them. I don't keep such things 
> directly in my settings because I keep them under version control. But 
> if you had unfettered acccess to my machine you could discover where 
> they are. You say you have the Ubuntu machine in question so you might 
> be able to find them. 
>
> The fingers crossed part is because the developer might have settled for 
> the Django Admin superuser credentials being the same as for the database. 
>
> If not, but you do have the database credentials you can dump the db, 
> start another Django project with the same source code and load a new 
> database to gain complete access to everything. 
>
> Also: any ideas about my first question? 
>
> No. I'm not a Mac person. But permissions on Macs are (I believe) the 
> same as for Linux/Unix. 
>
> Good luck 
>
> Mike 
>
> > 
> > Everyone: I'm in Naples, Florida. If anyone is in the Southwest Florida 
> > area and wants to try and help, I'll get you a Randy's key lime pie. Or 
> > take you out for seafood. Or something. 
> > 
> > On Sunday, July 6, 2014 7:36:46 PM UTC-4, Janelle O'Dea wrote: 
> > 
> > Hi all, 
> > 
> > I have two separate Django questions. 
> > 
> > One: I am trying to learn how to use Django on my computer (Mac OS, 
> > Mavericks) and was first getting the error "unable to open database" 
> > when running "python manage.py syncdb." To fix it, I followed 
> > instructions from here: https://coderwall.com/p/gl_grw 
> >  
> > Now, I can't save settings.py. I realize this may have to do with 
> > the advice to change permissions on the page I just linked to; how 
> > can I change them back? 
> > When I run the "python manage.py syncdb" command now, it tells me 
> > there's a syntax error in settings.py. When I try to fix settings.py 
> > and save it, it tells me ERRNO 13 permission denied. 
> > I'm mainly trying to get a feel for Django because I may want to use 
> > it in the near future. 
> > 
> > Two: At my workplace, someone produced a Django app on Ubuntu. The 
> > app is a source database for reporters to view and add to (I work at 
> > a newspaper). The main question: can I get the source information 
> > out of this database so that we can recover it and use it, even if 
> > the original creator of this app/database is not available? He isn't 
> > responding to phone calls or emails, and bosses want me to see if I 
> > can extract the info. I've never worked in Ubuntu before. 
> > 
> > Thanks for any help that anyone can provide. 
> > 
> > -- 
> > 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/38f6d8d0-efe2-4739-9e79-bdcd35f2cc7b%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/django-users/38f6d8d0-efe2-4739-9e79-bdcd35f2cc7b%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1bc66d35-aff3-4710-8a1d-b2d87d68be8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Serving static files from another directory rather than "statics"

2014-07-07 Thread carlos
Hi, maybe you need use this third party solution
http://django-compressor.readthedocs.org/en/latest/

and other is
https://django-pipeline.readthedocs.org/en/latest/

Cheers


On Mon, Jul 7, 2014 at 5:58 PM, Chen Xu  wrote:

> Hi Everyone,
> I am working on a site, under my project in my local environment, I have a
> directory called "static" (generated by django just like everyone else's)
> to server my js and css. I wrote a script which minify all the js and css
> files and copy them in a directory called "static_min" which is at the same
> level as "static". When I try to include my css and js files from
> "static_min", it show url not found.
>
> And I tried the followeing:
> in my settings: I changed the STATICFILES_DIRS as the following:
>
> STATIC_ROOT = sys.path[0]
>
> STATICFILES_DIRS = (
> os.path.join(STATIC_ROOT, 'static'),
> os.path.join(STATIC_ROOT, 'static_min')
> )
>
> I thought doing this will make Django to look for file in both static and
> static_min, but it did not work.
>
>
> Could someone help.
>
> Thanks
>
>
>
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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/CACac-qZbMcM6%2Bqs9frw1gToBSvbgD2NSaFtdOFrDfxScX%3DiVmg%40mail.gmail.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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAM-7rO28fM3wZmYL85jCXECaiiYnOrHhVv8%3DZSfKVmLV5-ox_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python 3 Usage

2014-07-07 Thread Timothy W. Cook
I've been using Python 3 with Django for about 8 months.  No real problems.
 Early on I had to patch a couple of add-ons.



On Mon, Jul 7, 2014 at 9:10 PM, Richard Eng 
wrote:

> I was wondering how many Django users have switched to Python 3. Are the
> majority of users still on Python 2? I'm looking for rough
> proportion/percentage.
>
> I also read that Django and Python 3 have some problems or issues. Is
> there any truth to this?
>
> 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/d2ac4e23-471a-4c11-a16d-54a11b7bef33%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3Xt8gzVQSBUqnyTKm3ij%2BqbV_3YJr5x5XQ8ALrQA4g7cQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Python 3 Usage

2014-07-07 Thread Richard Eng
I was wondering how many Django users have switched to Python 3. Are the 
majority of users still on Python 2? I'm looking for rough 
proportion/percentage.

I also read that Django and Python 3 have some problems or issues. Is there 
any truth to this?

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/d2ac4e23-471a-4c11-a16d-54a11b7bef33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Mysql connections after started django app

2014-07-07 Thread Zemian Deng
FYI: I found the conn leak is due to the mysql-connector-python. I started 
a post here if anyone is interested:

http://forums.mysql.com/read.php?50,616862,616862#msg-616862


On Friday, July 4, 2014 4:08:40 PM UTC-4, François Schiettecatte wrote:
>
> Hi 
>
> Again I think there is a bug somewhere in how django handles CONN_MAX_AGE 
> when it is not set or set to 0, you should not be seeing those sleeping 
> connections. 
>
> It is perfectly fine to set CONN_MAX_AGE to some number, though keep it to 
> less than the wait_timeout in my.cnf. You will still see sleeping 
> connections but that is normal with a connection pool. Django will create a 
> number of connections to the database as needed, reusing then when 
> appropriate and closing them after the timeout you set. This will save you 
> from having to ping your site to maintain the connections. Setting up a 
> connection to MySQL is very fast so there should be performance issues if 
> you set CONN_MAX_AGE to something like 60 (again check my.cnf). 
>
> Cheers 
>
> François 
>
>
> On Jul 4, 2014, at 12:39 PM, Zemian Deng > 
> wrote: 
>
> > Thanks for the tips @Francois! Yeah, I already have this CONN_MAX_AGE 
> set to 0. I even try some positive number, but there is still Sleep 
> connections remain after the app is started and running without any 
> traffic. Which is not what I expect when set to 0 value. 
> > 
> > I don't even have fancy background tasks that need long running 
> connection time. But my site is only been use every few days per week, so 
> it has timeout issue when first use. As I mentioned, my current workaround 
> is have a crontab task to "curl" my site hourly to keep it alive. Even at 
> this is not completely reliable since there are 5 established connections, 
> and not always refresh all of them per ping. 
> > 
> > 
> > 
> > On Fri, Jul 4, 2014 at 11:24 AM, François Schiettecatte <
> fschiet...@gmail.com > wrote: 
> > Hi 
> > 
> > I have a little experience with this, and I have posted about this here 
> before. 
> > 
> > The "MySQL Connection not available" message will occur when MySQL is 
> dropping the connection before Django is done with it, ie Django is trying 
> to send something down a dead connection. 
> > 
> > I would look at CONN_MAX_AGE in DATABASES (in settings.py) and 
> wait_timeout in my.cnf, the first should be lower than the second. 
> > 
> > For example I have these settings for a number of projects: 
> > 
> >'CONN_MAX_AGE': 3500,   # 3500 seconds because 
> wait_timeout = 3600 in my.cnf 
> > 
> > And this for another: 
> > 
> > 'CONN_MAX_AGE': 50, # 50 seconds because 
> wait_timeout = 60 in my.cnf 
> > 
> > Not setting CONN_MAX_AGE (or setting it to 0) in 1.6 caused the "MySQL 
> Connection not available" issue, I suspect there is a bug in how Django 
> handles its pooling but I have not checked. Seeing Sleeping connections on 
> MySQL is suggestive of that. A Sleeping connection just means it is idle 
> and waiting for stuff. 
> > 
> > I have a number of long running scripts, where more than an hour (3600 
> seconds) can elapse between database accesses, and I find I have to ping 
> the connections to see if they are still alive before I do any database 
> accesses, so I call the following method to ping the connections, and close 
> off dead connections: 
> > 
> > 
> > from django.db import connection 
> > 
> > def checkConnection(): 
> > 
> > # Check the connection, close if needed 
> > try: 
> > connection.connection.ping() 
> > # print 'INFO: connection.connection.ping()' 
> > except: 
> > connection.close() 
> > # print 'INFO: connection.close()' 
> > 
> > 
> > Hope this helps. 
> > 
> > https://docs.djangoproject.com/en/1.6/ref/databases/ 
> > 
> https://docs.djangoproject.com/en/1.6/ref/settings/#std:setting-CONN_MAX_AGE 
> > 
> > Cheers 
> > 
> > François 
> > 
> > 
> > On Jul 4, 2014, at 10:46 AM, cercatrova2  > wrote: 
> > 
> > > On 04/07/14 16:11, Zemian Deng wrote: 
> > >> @cercatrova2, 
> > >> 
> > >> Yes, my original problem also was (and still is) with "MySQL 
> Connection not available" after the 8 hours timeout inactivity on 
> webfaction hosting. I have to restart it whenever this happens and then 
> problem will go away. My current workaround is to schedule a dummy crontab 
> to hit my site every hour to keep connection timeout refresh. Not ideal, 
> but better than nothing so far. Thus I am looking for some help here. 
> > >> 
> > >> I really like MySQL, and I have tested my app with it already. It 
> would be a bummer to switch because of this just now. I have tried direct 
> usage of mysql.connection with just open and close a connection, and I do 
> see the process go away properly. This plus the number of process list is 
> increasing when I try simple "mysite" app lead me to think it might be 
> django related. I am not sure. Further testing would be need to verify 
> which end i

Serving static files from another directory rather than "statics"

2014-07-07 Thread Chen Xu
Hi Everyone,
I am working on a site, under my project in my local environment, I have a
directory called "static" (generated by django just like everyone else's)
to server my js and css. I wrote a script which minify all the js and css
files and copy them in a directory called "static_min" which is at the same
level as "static". When I try to include my css and js files from
"static_min", it show url not found.

And I tried the followeing:
in my settings: I changed the STATICFILES_DIRS as the following:

STATIC_ROOT = sys.path[0]

STATICFILES_DIRS = (
os.path.join(STATIC_ROOT, 'static'),
os.path.join(STATIC_ROOT, 'static_min')
)

I thought doing this will make Django to look for file in both static and
static_min, but it did not work.


Could someone help.

Thanks





-- 
⚡ Chen Xu ⚡

-- 
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/CACac-qZbMcM6%2Bqs9frw1gToBSvbgD2NSaFtdOFrDfxScX%3DiVmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Application Generators Comparison and Benefits list

2014-07-07 Thread Dean
No time for that, too busy... tortured and overwhelmed! :-/

On Tuesday, July 8, 2014 5:32:58 AM UTC+8, Dan Cancro wrote:
>
> Hi group,
>
> I made this comparison of things for starting a web application with 
> AngularJS and thought I would check here to see if a similar analysis had 
> taken place for Django application generators.
>
> http://dancancro.com/comparison-of-angularjs-application-starters/
>
> My goal is to clarify the similarities, strengths and weaknesses of the 
> options. In so doing, I hope that people will see how it makes more sense 
> to join forces on a single, great application generator instead of 
> competing against each other, duplicating work, and torturing overwhelmed 
> users by having many separate projects.
>
> So, two questions:
> 1) Do you know of any such comparison of things for making Django apps?
> 2) Can you think of any additions to the list of attributes or benefits in 
> the first column?  It does have some AngularJS specific stuff, but it is 
> meant to be as technology neutral as possible.
>
> Thanks,
> Dan
>

-- 
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/e974ca11-4cbb-4c76-89de-3ce949ed082a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Internal Request to third party inside a users request.

2014-07-07 Thread Russell Keith-Magee
On Tue, Jul 8, 2014 at 7:18 AM, James P  wrote:

> I have a situation where I want to make a third party request INSIDE a
> current users request.
>
> Essentially I want to alter the traditional oauth2 flow where the user is
> redirected back to the Application after authorizing their credentials for
> the first time. I would like the Application to receive the authorization
> code once the user approves it via an internal Request inside Django. But I
> want to redirect the user to stay within my site for some additional
> account process wizards.
>
> This is a situation where oath is being used to authorize a third part iOS
> or Android application, not a browser app so I essentially don't care if
> the user is redirected to the Application's own post-authorization splash
> page.
>

I'm not 100% certain I'm following what you're trying to do, but here's an
attempt at explaining what is possible.

You user is going to make a request for a specific URL. The server needs to
process this response, and give back a response which represents the
content of that URL. This is the basic HTTP contract, and it can't be
altered. Any plans you have for manipulating the oAuth2 flow must stay
within this basic contract.

However - what constitutes "content" of the URL is entirely up to your
server, and the manner in which that "content" is generated is entirely up
to you. It can be a static file on disc, a rendered template using data
from a database, a random number generator, or, if need be, the result of a
HTTP request that has gone off somewhere else.

So - for example - a user requests yourserver.com/example_page/. When it
receives that request, your server issues a request to
otherserver.com/magic_page, gathers the response, and returns it verbatim
to your original user. You user will then see the content of
otherserver.com/magic_page at the URL yourserver.com/example_page/.
Although the *content* looks like otherserver.com, it will be presented at
a yourserver.com URL.

If retrieving otherserver.com/magic_page requires some interaction from the
original user (e.g., logging in), you can't just "get the original user to
push buttons on the remote site" - any requests will need to be proxied
through your own server. So, if otherserver.com requires a login, the
process will be:

 * User requests yourserver.com/example_page
 * Your server requests otherserver.com/magic_page, and determines that
your user is not logged in
 * You return content to the original user that is a form requesting login
details. This might just be the login page provided by otherserver.com
 * The user submits their login details *TO YOURSERVER.COM/EXAMPLE_PAGE*
 * Your server takes those details, and submits them on the user's behalf
to otherserver.com/magic_page
 * You get a response from otherserver.com, which you pass back down to the
original user.

The important thing to note here is that *you are receiving and using the
user's credentials for a third party site*. The user isn't logging to
otherserver - *You* are logging into otherserver, on the user's behalf.
That means you've just encouraged a user to provide their password to a
third party site, which is a *really* bad idea. Think *very* hard before
you put a system like this into production.

I hope this helps.

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-PZpwX5GSz-ykEfM6SXzGCwTRNSgd6aT%2B6vOHpaU_ygA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django newbie issues

2014-07-07 Thread Mike Dewhirst

On 8/07/2014 2:22 AM, Janelle O'Dea wrote:

Thank you, Mike. I haven't tried your first option yet, but I will
either today or tomorrow. What kinds of clues would I look for in
settings?


Django needs credentials to access the database and there should be a 
mechanism specified in settings to get them. I don't keep such things 
directly in my settings because I keep them under version control. But 
if you had unfettered acccess to my machine you could discover where 
they are. You say you have the Ubuntu machine in question so you might 
be able to find them.


The fingers crossed part is because the developer might have settled for 
the Django Admin superuser credentials being the same as for the database.


If not, but you do have the database credentials you can dump the db, 
start another Django project with the same source code and load a new 
database to gain complete access to everything.


Also: any ideas about my first question?

No. I'm not a Mac person. But permissions on Macs are (I believe) the 
same as for Linux/Unix.


Good luck

Mike



Everyone: I'm in Naples, Florida. If anyone is in the Southwest Florida
area and wants to try and help, I'll get you a Randy's key lime pie. Or
take you out for seafood. Or something.

On Sunday, July 6, 2014 7:36:46 PM UTC-4, Janelle O'Dea wrote:

Hi all,

I have two separate Django questions.

One: I am trying to learn how to use Django on my computer (Mac OS,
Mavericks) and was first getting the error "unable to open database"
when running "python manage.py syncdb." To fix it, I followed
instructions from here: https://coderwall.com/p/gl_grw

Now, I can't save settings.py. I realize this may have to do with
the advice to change permissions on the page I just linked to; how
can I change them back?
When I run the "python manage.py syncdb" command now, it tells me
there's a syntax error in settings.py. When I try to fix settings.py
and save it, it tells me ERRNO 13 permission denied.
I'm mainly trying to get a feel for Django because I may want to use
it in the near future.

Two: At my workplace, someone produced a Django app on Ubuntu. The
app is a source database for reporters to view and add to (I work at
a newspaper). The main question: can I get the source information
out of this database so that we can recover it and use it, even if
the original creator of this app/database is not available? He isn't
responding to phone calls or emails, and bosses want me to see if I
can extract the info. I've never worked in Ubuntu before.

Thanks for any help that anyone can provide.

--
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/38f6d8d0-efe2-4739-9e79-bdcd35f2cc7b%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53BB2D86.5050803%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Internal Request to third party inside a users request.

2014-07-07 Thread James P
I have a situation where I want to make a third party request INSIDE a 
current users request.

Essentially I want to alter the traditional oauth2 flow where the user is 
redirected back to the Application after authorizing their credentials for 
the first time. I would like the Application to receive the authorization 
code once the user approves it via an internal Request inside Django. But I 
want to redirect the user to stay within my site for some additional 
account process wizards.

This is a situation where oath is being used to authorize a third part iOS 
or Android application, not a browser app so I essentially don't care if 
the user is redirected to the Application's own post-authorization splash 
page.

-- 
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/814ad3c9-752a-476c-9da8-f3eaa499ee31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Application Generators Comparison and Benefits list

2014-07-07 Thread Dan Cancro
Hi group,

I made this comparison of things for starting a web application with 
AngularJS and thought I would check here to see if a similar analysis had 
taken place for Django application generators.

http://dancancro.com/comparison-of-angularjs-application-starters/

My goal is to clarify the similarities, strengths and weaknesses of the 
options. In so doing, I hope that people will see how it makes more sense 
to join forces on a single, great application generator instead of 
competing against each other, duplicating work, and torturing overwhelmed 
users by having many separate projects.

So, two questions:
1) Do you know of any such comparison of things for making Django apps?
2) Can you think of any additions to the list of attributes or benefits in 
the first column?  It does have some AngularJS specific stuff, but it is 
meant to be as technology neutral as possible.

Thanks,
Dan

-- 
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/dbeff6f1-ae1b-4035-bcf6-71323e3511d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: settings.configure() does not allow me to access custom variables in settings.py

2014-07-07 Thread Bill Freeman
I don't know how fussy about not using stuff from django you are, but the
following works for me:

  $ DJANGO_SETTINGS_MODULE=foo.ct python
  >>> from django.conf import settings
  >>> settings.INSTALLED_APPS

Obviously, you replace "foo" with the name of your project.  This prints my
installed apps.  For settings with defaults, middlewares, for example, you
will the default if you haven't set it in your settings file.

You must have DJANGO_SETTINGS_MODULE in the environment, though you could,
instead of using the shell, add it to os.environ (I don't think that it has
to be there for the import from django.conf, but it must be there for the
first reference to an attribute of settings, which is a lazy object).

This doesn't import much, unless you have a things implied in your project
path or settings module.  I have the currect celery boiler plate in my
project's __init__.py file, so I get a lot of stuff.  Just check
sys.modules and see if the import load is too much for you before you go
re-implementing the django.conf mechanisms.


On Fri, Jul 4, 2014 at 5:12 PM, Chen Xu  wrote:

> Hi Everyone,
> I want to access some variables in my settings.py without starting my
> server, I know I will have to run settings.configure(); however, running
> settings.configure() does not allow me to access my custom variables.
>
> What should I do with that.
>
>
> Thanks
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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/CACac-qbCUJ3WCDVN022%3DU6nnh40X4tYPiW8oJ6q%3DY_LTGN9Bhw%40mail.gmail.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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB%2BAj0s4def1YrqcQ2V%2B2f%3DVcxfQkngxHmU2GMs-NtNH5eLwxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Beginning with a feature flag system

2014-07-07 Thread sk
Hello George,

Thank you. I was going through the documentation sometime back. Do you know 
if there is an "Hello World" example that uses Django waffle? I am not able 
to determine what changes need to be done to make a simple django project 
work.


Regards,
spk265

On Monday, July 7, 2014 4:19:40 PM UTC-4, george wrote:
>
> Django Waffle is very good.
>
>
> On Mon, Jul 7, 2014 at 5:07 PM, sk > wrote:
>
>> Hello All,
>>
>> I would like to try out one of the feature flag libraries available for 
>> Django. So far I have come across Gargoyle - a feature flag library and 
>> cannot wrap my head around as to how it should be implemented. Does anyone 
>> know of any tutorial or can guide me how to go about it?
>>
>> If there are any other libraries that are easy to use(with a "Hello 
>> World" example and good documentation), please do share.
>>
>>
>> -spk265
>>
>> -- 
>> 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/45bdc344-b927-4379-a6a3-be22aab1fd80%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> George R. C. Silva
> SIGMA Consultoria
> 
> http://www.consultoriasigma.com.br/
>   

-- 
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/670ff0a6-e0e9-4746-b471-6bd135ed9c75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Beginning with a feature flag system

2014-07-07 Thread George Silva
Django Waffle is very good.


On Mon, Jul 7, 2014 at 5:07 PM, sk  wrote:

> Hello All,
>
> I would like to try out one of the feature flag libraries available for
> Django. So far I have come across Gargoyle - a feature flag library and
> cannot wrap my head around as to how it should be implemented. Does anyone
> know of any tutorial or can guide me how to go about it?
>
> If there are any other libraries that are easy to use(with a "Hello World"
> example and good documentation), please do share.
>
>
> -spk265
>
> --
> 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/45bdc344-b927-4379-a6a3-be22aab1fd80%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
George R. C. Silva
SIGMA Consultoria

http://www.consultoriasigma.com.br/

-- 
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/CAGyPVTttBR7FwJB0tNv3p4MLHEouSePGahQ8DAj59eaLi%2B00cQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Beginning with a feature flag system

2014-07-07 Thread sk
Hello All,

I would like to try out one of the feature flag libraries available for 
Django. So far I have come across Gargoyle - a feature flag library and 
cannot wrap my head around as to how it should be implemented. Does anyone 
know of any tutorial or can guide me how to go about it?

If there are any other libraries that are easy to use(with a "Hello World" 
example and good documentation), please do share.


-spk265

-- 
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/45bdc344-b927-4379-a6a3-be22aab1fd80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


geo data fixture with loaddata, YAML

2014-07-07 Thread Ben Dean
Hi, 

I wanted to cross post this here from the original 
 on the 
geodjango group. I let the details stand there, but summarize here:

Trying to use manage.py loaddata to get a YAML fixture containing a 
geoDjango "MultiPolygonField", but I am running into some problem with the 
serialization format:
*Cannot set Neighborhood GeometryProxy (MULTIPOLYGON) with value of type: 
*
or
*Cannot set Neighborhood GeometryProxy (MULTIPOLYGON) with value of type: 
*

Hoping someone with more YAML/loaddata expertise can point me in the right 
direction vis. this formatting problem

-- 
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/b3b2bdf4-e011-42f1-931b-72b0cbd36ed1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django newbie issues

2014-07-07 Thread Janelle O'Dea
Thank you, Mike. I haven't tried your first option yet, but I will either 
today or tomorrow. What kinds of clues would I look for in settings? Also: 
any ideas about my first question?

Everyone: I'm in Naples, Florida. If anyone is in the Southwest Florida 
area and wants to try and help, I'll get you a Randy's key lime pie. Or 
take you out for seafood. Or something. 

On Sunday, July 6, 2014 7:36:46 PM UTC-4, Janelle O'Dea wrote:
>
> Hi all,
>
> I have two separate Django questions. 
>
> One: I am trying to learn how to use Django on my computer (Mac OS, 
> Mavericks) and was first getting the error "unable to open database" when 
> running "python manage.py syncdb." To fix it, I followed instructions from 
> here: https://coderwall.com/p/gl_grw 
> Now, I can't save settings.py. I realize this may have to do with the 
> advice to change permissions on the page I just linked to; how can I change 
> them back? 
> When I run the "python manage.py syncdb" command now, it tells me there's 
> a syntax error in settings.py. When I try to fix settings.py and save it, 
> it tells me ERRNO 13 permission denied. 
> I'm mainly trying to get a feel for Django because I may want to use it in 
> the near future. 
>
> Two: At my workplace, someone produced a Django app on Ubuntu. The app is 
> a source database for reporters to view and add to (I work at a newspaper). 
> The main question: can I get the source information out of this database so 
> that we can recover it and use it, even if the original creator of this 
> app/database is not available? He isn't responding to phone calls or 
> emails, and bosses want me to see if I can extract the info. I've never 
> worked in Ubuntu before. 
>
> Thanks for any help that anyone can provide. 
>

-- 
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/38f6d8d0-efe2-4739-9e79-bdcd35f2cc7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django beginner

2014-07-07 Thread monoBOT
is the
__init__.py
file in the directory?


2014-07-07 15:13 GMT+01:00 ngangsia akumbo :

> yes i added it to installed app
>
> On Monday, July 7, 2014 2:48:17 PM UTC+1, Javier Guerra wrote:
>
>> On Mon, Jul 7, 2014 at 8:17 AM, ngangsia akumbo 
>> wrote:
>> > But i have just created a separate app call photo, but when i run
>> syncdb
>> > nothing happens
>>
>>
>> have you added it to INSTALLED_APPS in settings.py?
>>
>> --
>> Javier
>>
>  --
> 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/630c6a3e-07d4-4840-ad3c-fa52a6a0e6db%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*monoBOT*
Visite mi sitio(Visit my site): monobotsoft.es/blog/

-- 
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%2BxOsGBD76LE0nJOTtXVGcOe_jasBCVDKCa-t6ggStZ%2B5cGHLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.6 + Mysql

2014-07-07 Thread Carlos Arturo Sanchez Rivera
Check this tw:

 https://twitter.com/iscenigmax/status/485657005567115264

El sábado, 5 de julio de 2014 19:03:56 UTC-5, Henrique Oliveira escribió:
>
> hi there,
>
> I am getting this error when using Mysql connector:
>
> File "/opt/b360/lib/python3.4/site-packages/django/core/handlers/base.py", 
> line 114, in get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs)
>
>   File 
> "/opt/b360/lib/python3.4/site-packages/django/views/generic/base.py", line 
> 69, in view
> return self.dispatch(request, *args, **kwargs)
>
>   File 
> "/opt/b360/lib/python3.4/site-packages/django/views/generic/base.py", line 
> 87, in dispatch
> return handler(request, *args, **kwargs)
>
>   File "/opt/b360/lib/python3.4/site-packages/allauth/account/views.py", 
> line 194, in get
> self.object = self.get_object()
>
>   File "/opt/b360/lib/python3.4/site-packages/allauth/account/views.py", 
> line 258, in get_object
> return queryset.get(key=self.kwargs["key"].lower())
>
>   File "/opt/b360/lib/python3.4/site-packages/django/db/models/query.py", 
> line 301, in get
> num = len(clone)
>
>   File "/opt/b360/lib/python3.4/site-packages/django/db/models/query.py", 
> line 77, in __len__
> self._fetch_all()
>
>   File "/opt/b360/lib/python3.4/site-packages/django/db/models/query.py", 
> line 854, in _fetch_all
> self._result_cache = list(self.iterator())
>
>   File "/opt/b360/lib/python3.4/site-packages/django/db/models/query.py", 
> line 220, in iterator
> for row in compiler.results_iter():
>
>   File 
> "/opt/b360/lib/python3.4/site-packages/django/db/models/sql/compiler.py", 
> line 709, in results_iter
> for rows in self.execute_sql(MULTI):
>
>   File 
> "/opt/b360/lib/python3.4/site-packages/django/db/models/sql/compiler.py", 
> line 772, in execute_sql
> sql, params = self.as_sql()
>
>   File 
> "/opt/b360/lib/python3.4/site-packages/django/db/models/sql/compiler.py", 
> line 93, in as_sql
> where, w_params = self.query.where.as_sql(qn=qn, 
> connection=self.connection)
>
>   File 
> "/opt/b360/lib/python3.4/site-packages/django/db/models/sql/where.py", line 
> 103, in as_sql
> sql, params = child.as_sql(qn=qn, connection=connection)
>
>   File 
> "/opt/b360/lib/python3.4/site-packages/django/db/models/sql/where.py", line 
> 106, in as_sql
> sql, params = self.make_atom(child, qn, connection)
>
>   File 
> "/opt/b360/lib/python3.4/site-packages/django/db/models/sql/where.py", line 
> 181, in make_atom
> lvalue, params = lvalue.process(lookup_type, params_or_value, 
> connection)
>
>   File 
> "/opt/b360/lib/python3.4/site-packages/django/db/models/sql/where.py", line 
> 365, in process
> connection=connection, prepared=True)
>
>   File 
> "/opt/b360/lib/python3.4/site-packages/django/db/models/fields/__init__.py", 
> line 407, in get_db_prep_lookup
> prepared=prepared)]
>
>   File 
> "/opt/b360/lib/python3.4/site-packages/django/db/models/fields/__init__.py", 
> line 912, in get_db_prep_value
> return connection.ops.value_to_db_datetime(value)
>
>   File 
> "/opt/b360/lib/python3.4/site-packages/mysql/connector/django/base.py", 
> line 398, in value_to_db_datetime
> return self.connection.connection.converter._datetime_to_mysql(value)
>
> AttributeError: 'NoneType' object has no attribute 'converter'
>
> Any Ideas?
>

-- 
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/6deab4a4-99e0-4c0b-8ab8-6c4b831bf255%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Python Brasil 10] Registrations are now open!

2014-07-07 Thread Renato Oliveira
Hey everyone!
Registrations for Python Brasil are now open!

http://2014.pythonbrasil.org.br/register

Sadly the payment form is in portuguese, so if you have any trouble please
let me know (in private message).
The call for papers will open on Jul 10th as you can see here

http://2014.pythonbrasil.org.br/about

For now the announced keynotes are:
Alex Gaynor
http://2014.pythonbrasil.org.br/news/keynotes-alex-gaynor

Fernando Perez
http://2014.pythonbrasil.org.br/news/keynotes-fernando-perez

Lynn Root
http://2014.pythonbrasil.org.br/news/keynotes-lynn-root

And this beach is waiting for you:
http://2014.pythonbrasil.org.br/venue

Please, help us by spreading the word :)
Thanks

Renato Oliveira
@_renatooliveira 
Labcodes - www.labcodes.com.br

-- 
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/CAGPLouVB0rc_sBnLf%2BC6y1843Qb1-UPVaA2ZqSjZ-WMKMi%2BuLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django beginner

2014-07-07 Thread ngangsia akumbo
yes i added it to installed app

On Monday, July 7, 2014 2:48:17 PM UTC+1, Javier Guerra wrote:
>
> On Mon, Jul 7, 2014 at 8:17 AM, ngangsia akumbo  > wrote: 
> > But i have just created a separate app call photo, but when i run syncdb 
> > nothing happens 
>
>
> have you added it to INSTALLED_APPS in settings.py? 
>
> -- 
> Javier 
>

-- 
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/630c6a3e-07d4-4840-ad3c-fa52a6a0e6db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django beginner

2014-07-07 Thread Javier Guerra Giraldez
On Mon, Jul 7, 2014 at 8:17 AM, ngangsia akumbo  wrote:
> But i have just created a separate app call photo, but when i run syncdb
> nothing happens


have you added it to INSTALLED_APPS in settings.py?

-- 
Javier

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


Re: django beginner

2014-07-07 Thread ngangsia akumbo
I have created my first app for my website which is a news post that will 
be located on the menu bar. 

I wish to create a separate app for photo, events, calendars , services and 
a contact all on the same site.

But i have just created a separate app call photo, but when i run syncdb 
nothing happens

I don't know to treat this apps separately on the same database
am using sqlite3 django-1.4.13.

How do i create multiple apps on one site?

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/a74e46b8-f144-4273-bc5d-cea92fd281f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to filter objects by values of foreign objects in Django admin

2014-07-07 Thread 9devmail
No, it does not. I cannot pass any parameters to this function, because it 
is being invoked automatically by the admin.

class MyAdmin(admin.ModelAdmin):
list_display = ['num_of_trans']

How can I pass any arguments to it?

Please, read my question carefully.

-- 
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/5748b53a-d697-40df-a732-4a6d14d742ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to filter objects by values of foreign objects in Django admin

2014-07-07 Thread Tom Evans
On Mon, Jul 7, 2014 at 11:47 AM,  <9devm...@gmail.com> wrote:
> There are tables Product and Transaction. In Product admin there is a field
> that shows how many transactions have been created with this product.
>
> Now, I want to filter the period of time in which these transactions were
> created. For example, there was 30 transactions in the last week, but 100 in
> the last month.
>
> class Transaction(models.Model):
> created = models.DateTimeField()
> product = models.ForeignKey('Product')
>
> class Product(models.Model):
> name = models.CharField()
>
 def num_of_trans(self, start_date=None, end_date=None):
  qs = self.transaction_set.all()
  if start_date:
  qs = qs.filter(created__gt=start_date)
  if end_date:
  qs = qs.filter(created__lt=end_date)
  return qs


Does that suffice?

Cheers

Tom

-- 
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/CAFHbX1K9o1ujaZbRjtuM3Tm9f%3DzkR5WAN5MHpWYaBYs-kF%2BWQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to filter objects by values of foreign objects in Django admin

2014-07-07 Thread 9devmail
Thank you, but I think you misunderstood.

I do not want to filter Product objects. I want to filter Transaction 
objects.

Please, take a look at provided example.

-- 
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/d5ba360d-2838-48f3-9cd5-0baa8111be1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to filter objects by values of foreign objects in Django admin

2014-07-07 Thread Lachlan Musicman
Gah, sorry. Fat thumbed the send button

https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.filter

On 7 July 2014 22:21, Lachlan Musicman  wrote:
> For Range of dates:
>
> https://docs.djangoproject.com/en/dev/ref/models/querysets/#range
>
> for "greater than" or "less than" dates (and what that means), look at
> the filter docs:
>
>
> On 7 July 2014 22:12,  <9devm...@gmail.com> wrote:
>> Thanks for pointing it out.
>>
>> However, my question is about a different issue.
>>
>> --
>> 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/fa5bbf2c-c699-4ef2-8b4e-85b14206d7f6%40googlegroups.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> The idea is that a beautiful image is frameable. Everything you need
> to see is there: It’s everything you want, and it’s very pleasing
> because there’s no extra information that you don’t get to see.
> Everything’s in a nice package for you. But sublime art is
> unframeable: It’s an image or idea that implies that there’s a bigger
> image or idea that you can’t see: You’re only getting to look at a
> fraction of it, and in that way it’s both beautiful and scary, because
> it’s reminding you that there’s more that you don’t have access to.
> It’s now sort of left the piece itself and it’s become your own
> invention, so it’s personal as well as being scary as well as being
> beautiful, which is what I really like about art like that.
> ---
> Adventure Time http://theholenearthecenteroftheworld.com/



-- 
The idea is that a beautiful image is frameable. Everything you need
to see is there: It’s everything you want, and it’s very pleasing
because there’s no extra information that you don’t get to see.
Everything’s in a nice package for you. But sublime art is
unframeable: It’s an image or idea that implies that there’s a bigger
image or idea that you can’t see: You’re only getting to look at a
fraction of it, and in that way it’s both beautiful and scary, because
it’s reminding you that there’s more that you don’t have access to.
It’s now sort of left the piece itself and it’s become your own
invention, so it’s personal as well as being scary as well as being
beautiful, which is what I really like about art like that.
---
Adventure Time http://theholenearthecenteroftheworld.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+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/CAGBeqiMC9d%3DLtFQAOfRUciA7Q5nJwYrY1m%3DYjr9Yb58aVDSQ9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to filter objects by values of foreign objects in Django admin

2014-07-07 Thread Lachlan Musicman
For Range of dates:

https://docs.djangoproject.com/en/dev/ref/models/querysets/#range

for "greater than" or "less than" dates (and what that means), look at
the filter docs:


On 7 July 2014 22:12,  <9devm...@gmail.com> wrote:
> Thanks for pointing it out.
>
> However, my question is about a different issue.
>
> --
> 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/fa5bbf2c-c699-4ef2-8b4e-85b14206d7f6%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 
The idea is that a beautiful image is frameable. Everything you need
to see is there: It’s everything you want, and it’s very pleasing
because there’s no extra information that you don’t get to see.
Everything’s in a nice package for you. But sublime art is
unframeable: It’s an image or idea that implies that there’s a bigger
image or idea that you can’t see: You’re only getting to look at a
fraction of it, and in that way it’s both beautiful and scary, because
it’s reminding you that there’s more that you don’t have access to.
It’s now sort of left the piece itself and it’s become your own
invention, so it’s personal as well as being scary as well as being
beautiful, which is what I really like about art like that.
---
Adventure Time http://theholenearthecenteroftheworld.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+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/CAGBeqiNFZs20g6DyKuVjAym5Gnr5XSzC-%3DeZFuyNksDd8bPqmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to filter objects by values of foreign objects in Django admin

2014-07-07 Thread 9devmail
Thanks for pointing it out.

However, my question is about a different issue.

-- 
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/fa5bbf2c-c699-4ef2-8b4e-85b14206d7f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to filter objects by values of foreign objects in Django admin

2014-07-07 Thread Shubham Pansari
Instead of self.id you should use self itself as using self.id will not
work.


On Mon, Jul 7, 2014 at 4:17 PM, <9devm...@gmail.com> wrote:

> There are tables Product and Transaction. In Product admin there is a
> field that shows how many transactions have been created with this product.
>
> Now, I want to filter the period of time in which these transactions were
> created. For example, there was 30 transactions in the last week, but 100
> in the last month.
>
> class Transaction(models.Model):
> created = models.DateTimeField()
> product = models.ForeignKey('Product')
> class Product(models.Model):
> name = models.CharField()
>
> def num_of_trans(self):
> return 
> Transaction.objects.filter(created="""DATE_VALUE_HERE""").filter(product=self.id).count()
>
> I tried to adjust the queryset in a class that extends SimpleListFilter,
> however I did not manage to make it work.
>
> Another thing I thought of was to add an additional parameter to
> num_of_trans function, but it seems there is not way to pass this
> parameter while using the filter.
>
> I would appreciate any tips.
>
> --
> 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/c1612d89-d28b-4c82-b17d-703c43cc581d%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOdEGu3rA6vM2XJvci9Li-0p%2BVvF8h7WJ9gNvV%2BBfibCovyFXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to filter objects by values of foreign objects in Django admin

2014-07-07 Thread 9devmail


There are tables Product and Transaction. In Product admin there is a field 
that shows how many transactions have been created with this product.

Now, I want to filter the period of time in which these transactions were 
created. For example, there was 30 transactions in the last week, but 100 
in the last month.

class Transaction(models.Model):
created = models.DateTimeField()
product = models.ForeignKey('Product')
class Product(models.Model):
name = models.CharField()

def num_of_trans(self):
return 
Transaction.objects.filter(created="""DATE_VALUE_HERE""").filter(product=self.id).count()

I tried to adjust the queryset in a class that extends SimpleListFilter, 
however I did not manage to make it work.

Another thing I thought of was to add an additional parameter to 
num_of_trans function, but it seems there is not way to pass this parameter 
while using the filter.

I would appreciate any tips.

-- 
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/c1612d89-d28b-4c82-b17d-703c43cc581d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.