Re: Is Django limited by Python's GIL? If not, are there any benchmarks for multiple connections?

2020-05-26 Thread graeme
On Tuesday, May 26, 2020 at 1:33:47 PM UTC+1, navinipe wrote: > > Hello, > > I'm a freelancer just getting introduced to web app programming, and will > soon need to create web apps for clients who want a database of info for > many of their customers and clients who want an e-commerce

Re: Hosting a django website

2020-01-27 Thread graeme
I have had issues with Django and cpanel. Last time I tried it was less than straightforward (cpanel's version of Apache would not work with the distro's mod_wsgi). There are a number shared hosts who explicitly support Django, and even some who specialise in it. I would avoid deploying Django

Does a custom user model require first_name and last_name fields

2020-01-20 Thread graeme
I have people's first names and last names in another model (because not all people in the DB are users). Therefore if I store names in the user model I will duplicate data. I think the right solution is to remove the first_name and last_name user models from the custom user model. Will this

Re: Django deployment

2018-03-24 Thread graeme
On Saturday, March 24, 2018 at 12:42:52 PM UTC, Goran Radanovic wrote: > > I have set up a server with Ubuntu, Nginx, uwisg, Postgres and Django. I > got this part figured out its running multiple sites with each of its own > virtalenv. > > My development is on Windows 10 and pycharm, what I

Re: How do I exactly change from SQLite to MySQL ?

2018-01-15 Thread graeme
On Monday, January 15, 2018 at 12:11:58 PM UTC, Mike Dewhirst wrote: snip > > > From my research it seems Postgres is probably the best option for > Django if you want stability with scalability and atomicity. > In addition Django how comes with postgres specific functionality in

Re: Problem testing user is None when extending auth backend.

2017-09-28 Thread graeme
if user.is_authenticated() and user.is_staff: > do something > else: > do something else > except AttributeError as err: > log.error('User not found:%s' % err) > > > On Thursday, 28 September 2017 13:50:27 UTC+2, graeme wrote: >> >> In a custom aut

Problem testing user is None when extending auth backend.

2017-09-28 Thread graeme
In a custom authentication backend, I was getting this error with this (previous developer's!) code: if user.is_authenticated() and user.is_staff: AttributeError: 'NoneType' object has no attribute 'is_authenticated' The cause seemed clear, the parent classes method was run first with

Migration for auth_user.username field

2017-07-18 Thread Graeme Perrow
I am responsible for the SQL Anywhere Django driver and I'm trying to add support for Django 1.10. When I create a project and run "python manage.py migrate", it executes a bunch of SQL statements but then fails when altering the auth_user table

Re: Postgres SQL vs SQLite vs MS SQL vs MY SQL

2016-12-22 Thread graeme
SQLite is very good for what it is and requires zero admin and no installation, but it cannot scale, has no replication, and cannot run on separate server. Postgres has robust transaction DDL, which means that if you get a crash in the middle of a migration the change gets reversed. MySQL does

Re: virtualenv is not compatible with this system

2016-12-13 Thread graeme
It looks like you are trying to use virtualenv with Anaconda. I would have thought conda is likely to work better with Anaconda (I do not know whether virtualenv will work at all with Anaconda, conda is certainly the usual way to create virtual environments with Anaconda). On Tuesday, December

Re: Better style: from django.db import models vs from django.db.models import ...

2016-08-03 Thread graeme
On Monday, August 1, 2016 at 5:59:17 PM UTC+5:30, Michal Petrucha wrote: > > On Mon, Aug 01, 2016 at 05:09:37AM -0700, graeme wrote: > Either way is fine, using models.IntegerField > and forms.IntegerField just makes it more obvious what kind of > IntegerField it is y

Better style: from django.db import models vs from django.db.models import ...

2016-08-01 Thread graeme
I have always imported models, and then: class Foo(models.Model): bar = models.CharField(max_length=100) which is what the examples in the django docs do - I copied it when I started using Django and the habit stuck. It is a lot less verbose to do: from models import Model, CharField

Re: No Downtime Code Releases

2016-04-19 Thread graeme
On Wednesday, April 20, 2016 at 3:19:59 AM UTC+5:30, Avraham Serour wrote: > > you can easily do code reloading with uwsgi graceful reload, no user will > ever know you reloaded your application, no need to juggle, I mean you > aren't using mod_wsgi or anything like that right? > mod_wsgi in

Re: Django decision for tour reservation database

2015-12-15 Thread graeme
If in doubt use the full stack framework - you do not have to use features you do not want. On the other hand if you use a micro-framework and later decide you need the features of the full stack framework you have to port your code. I suggest using PostgreSQL instead of MySQL - it handles

Re: git exclude files

2015-12-13 Thread graeme
On Saturday, December 12, 2015 at 2:38:29 AM UTC+5:30, Gary Roach wrote: > > /root/archive/lib files in the git repository or should they be > excluded. If the need to be excluded, how. > Definitely exclude it. There are lots of things that may make it break on a different system. As

Re: virtualenv best practice / source control

2015-10-01 Thread graeme
On Thursday, October 1, 2015 at 5:51:57 PM UTC+5:30, junk wrote: > > Greetings wise django users, > > Can someone provide a link or description of how to use > virtualenv/django/source-control all at the same time? > > I thought I would put my virtualenv code, and django, and a starter >

Re: Learning Python and Django and should I?? (I have a year of 10 or so hours a week)

2015-08-16 Thread graeme
A lot of it is a matter of personal preference, and a lot comes down to whether you prefer Python or Ruby. Python is more general purpose than Ruby, and a lot more general purpose than PHP, so it is much more likely to be useful outside web apps, or if you need unusual functionality within a

migrate gives SQL error on my DB backend

2015-06-29 Thread Graeme Perrow
he migration stuff to know what it is I'm missing. Can anyone help? Thanks Graeme Perrow -- 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-us

Re: Alternatives to Django REST Framework

2015-04-09 Thread graeme
If you do not need Django at all, Flask or Bottle. If you are going to use Django anyway, just use a Django view that return JSON, XML or whatever you want. On Thursday, April 9, 2015 at 6:25:21 PM UTC+5:30, amit.p...@gmail.com wrote: > > Hi, > > while Django REST Framework seems wonderful to

Re: Web and mobile app with Django? Kivy? sth else?

2014-12-06 Thread graeme
If you want to do everything in Python (which I like to) my choices would be Django for the backend, Kivy for the mobile apps, and Django Rest Framework to provide APIs for the mobile apps. If you want to keep it simpler maybe a responsive web design will be enough, so you only need Django,

Is 1.7 RC1 supposed to support migrations changing user model? Not sure whether to report error as bug!

2014-07-09 Thread graeme
Having read through the comments on this bug: https://code.djangoproject.com/ticket/22563 I can see that migrations were not originally intended to support changing AUTH_USER_MODEL after the initial migration. However I am confused about whether it now should. The later comments and the

Re: How to have two separate models authentication system in the same django project?

2014-06-10 Thread graeme
Have you tried copying the content of contrib/auth and placing it in a directory in your app? It should work (perhaps with a bit of tweaking) BUT you will have to be careful where they both use the same data (for example the setting for the login url) and may have other problems. I cannot see

Column type and index not support by Django ORM - best way to alter/add them

2014-05-26 Thread graeme
I need to do the the following to Postgres tables for Django models: 1) Add a functional index 2) Have a bigserial primary key and a bigint foreign key point to it. Given that I only want this on a single install, is there any reason not to just do it directly? I have found code snippets with

Re: Django-Associations v0.1.7 Released.

2014-03-11 Thread graeme
The docs say: It may or may not work with traditional Function Based Views Almost all views I write are function based. Its the same in most of the code I have seen from other people. You say "maybe" so I will try it when I get a chance... I would also really like to see it as a panel for

Re: Do you think Django's future is threatened by JS frameworks in both client & server?

2014-01-28 Thread graeme
On Tuesday, January 28, 2014 1:00:31 PM UTC+5:30, Avraham Serour wrote: > > you will eventually need to keep a couple of different codebases in some > different languges. > Say you get popular enough and now you need to launch a desktop app, > android and iphone. > Take dropbox for example, they

Re: django with no relational db?

2014-01-22 Thread graeme
You do lose a lot without a relational DB: model forms, auth, admin. I think sessions should work as long as you do not use the DB backend. You could try django-nonrel: http://django-nonrel.org/ I have never tried it myself but from the documentation it seems to keep a lot more of the

South migration when custom field definitions change

2013-10-28 Thread graeme
I have an app that uses some custom model fields. These are subclasses of standard fields. I have tried to include as many defaults as possible in custom field to stick to DRY. I have written South introspection rules for these that work fine when I change a model What happens when I change

Re: Have browsers broken post-redirect-get? best practice now?

2013-10-05 Thread graeme
On Friday, October 4, 2013 12:00:47 PM UTC+5:30, dspruell wrote: > > On Thu, Oct 3, 2013 at 6:15 AM, graeme <graeme@gmail.com > > wrote: > > I disagree that breaking the back button is always bad. For example > suppose > > you have a series of forms (i.e.

Re: Have browsers broken post-redirect-get? best practice now?

2013-10-05 Thread graeme
gt; or do whatever is appropriate given that they are submitting the same > form again. I think the functionality of the browser's back button is > universal and accepted and shouldn't be broken or reinvented. > > -Dave > > On Thu, Oct 3, 2013 at 8:15 AM, graeme <graeme...

Re: Have browsers broken post-redirect-get? best practice now?

2013-10-03 Thread graeme
mpt about resending > post data, or are you just talking about being able to use the back button > at all? If the latter, that's exactly what should happen. Breaking the > user's back button is bad. > > On Tuesday, October 1, 2013 12:41:20 PM UTC, graeme wrote: >> >&g

Re: Multiple versions of Django

2013-10-01 Thread graeme
On Tuesday, October 1, 2013 8:45:37 AM UTC+5:30, Jasvir Singh wrote: > > On Mon, 30 Sep 2013, Jasvir Singh wrote: > > I have django 1.4.2 installed on ubuntu server which uses apache. > There are several django based applications installed on it. All of > them are working on django 1.4.2 .

Have browsers broken post-redirect-get? best practice now?

2013-10-01 Thread graeme
The Django docs (and a lot else) recommend redirecting after successfully processing a post request (if it changes data). i.e. post, the save stuff to the database, then redirect. Current browsers seem to allow this. I have tried Chromium 28 and 24 on Linux, I user return redirect(...) after

Fixing missing permissions (not in contrib.auth.models.Permission table in db)

2013-09-19 Thread graeme
As far as I can see the permissions should be there. I checked the South migration I used to add the Model and it seems correct: the schema migration creates the table and then calls db.send_create_signal('managed_villas', ['GuestReview']) How do I fix it? The ContentType exists and seems

Re: PDF generator in Django

2013-08-05 Thread graeme
I recently used Latex and it worked fairly well. I had to write a little function to escape latex special characters, and you have to be a bit careful with some characters when mixing Latex and Django templates. It would not be easy if you needed to insert formatted text into the template,

Re: django DB optimization

2013-03-05 Thread graeme
10,000 people does not sound like too heavy a load. How often will they check their schedules? If you are looking up items by day and user, then indices on day and (foreign key on) user should be enough to handle a much heavier load. If you do find you need caching, using Django's built in

Re: Development server won't work from a shared web host

2012-09-07 Thread graeme
On Friday, September 7, 2012 8:38:56 AM UTC+5:30, ecs1749 wrote: > > Well, that's almost true :-) > > Granted - it's a lot easier so far but I had to track down several things > (and a whole lot of "here's how" tips) that were taken for granted (like > pip which require easy_install so on

Re: Development server won't work from a shared web host

2012-09-07 Thread graeme
On Tuesday, September 4, 2012 11:43:53 AM UTC+5:30, Daniel Roseman wrote: > > On Tuesday, 4 September 2012 03:32:08 UTC+1, ecs1749 wrote: >> >> Thanks for the reply. Yes, I saw that message. I am a bit lost where to >> go next if I completely ignore that tutorial regarding doing admin from

Re: Announcement of GUI for Creating Models

2012-09-07 Thread graeme
On Saturday, September 8, 2012 8:16:18 AM UTC+5:30, Alec Taylor wrote: > > Suggestion: go visual > > E.g.: fork this - http://gaesql.appspot.com/ > This already seems to do that: http://code.google.com/p/uml-to-django/ I have not tried it: I am put off by the way it splits models.py and

Tip for Geany users or those looking for lightweight IDE

2012-05-19 Thread graeme
All it needs is a quick Google to find it, but I missed it before. This tip on the Geany wiki on how to set it up to work with a syntax checker is veru useful - IMO it plugs the biggest gap in Geany's functionality: http://wiki.geany.org/howtos/check_python_code In fact you do not need use the

APPEND_SLASH = True with URL patterns without slash

2012-04-14 Thread graeme
I have the following setup using Django 1.3: 1) Middleware that changes request.urlconf depending on the domain requested 2) APPEND_SLASH = True 3) One URL pattern that does not end in a slash. A request for a URL that matches the the pattern that does not end in a slash is redirected. It works

Re: Django (or other) templates for untrusted users?

2012-02-09 Thread graeme
m of nested loops also does not seem to have a solution. > > Bill > > On 1/26/12, graeme <graeme.piete...@gmail.com> wrote: > > > > > > > > > Are Django templates safe enough to use templates provided by > > untrusted users? Is it possible to limit

Django (or other) templates for untrusted users?

2012-01-26 Thread graeme
Are Django templates safe enough to use templates provided by untrusted users? Is it possible to limit functionality? I am not only concerned with what the templates can access, but also things like being able to consume excessive resources with, for example, deeply nested loops. If not Django

Re: Django as a Standalone Desktop Application

2011-10-24 Thread graeme
On Oct 24, 3:42 pm, Tom Evans wrote: > I have a number of non-web django processes, so I'm not against that > in general. However, installing a full LAMP/WAMP stack, django and all You do not necessarilly need a full lamp stack. Use Cherrpy (or similar) and SQLite for

Adding calculated field depending on admin form and inlines/related models

2011-10-06 Thread graeme
I want to store the result of an expensive calculation in my model. It should be caculated if the the current value is null. It should also be calculated if requested on the admin form (I added a Boolean field to the form for this purpose). The problem is that the calculation requires values

Re: Helping someone move from Joomla to Django

2011-10-06 Thread graeme
Joomla may have those shortcomings, but its not the only alternative. If someone likee PHP, already knows PHP or has to use PHP, there are a lot of PHP fraeworks: from light ones, to ones feature comparable to Django (although I do not know of any framework that can match Django Admin). The best

Re: Calculated value that depends in related models

2011-09-19 Thread graeme
(and many others like me) recommend redis and django-redis-cache[3] for > this. > > Cheers, > AT > > [1]http://redis.io/ > [2]https://bitbucket.org/kmike/django-view-cache-utils > [3]https://github.com/sebleier/django-redis-cache > > > > On Mon, Sep 19, 2011 at 12:2

Calculated value that depends in related models

2011-09-19 Thread graeme
I want to save a calculated value to a model field. The calculation takes a few seconds and I need to query by it, so I think the denormalisation is justified. The problem is that the calculation requires data from two related models: one of which is the "through" model of a ManyToMany

Re: is photologue still maintained?

2011-09-16 Thread graeme
It may or may not help you, but ImageKit seems actively maintained: https://github.com/jdriscoll/django-imagekit http://groups.google.com/group/django-photologue/browse_thread/thread/4b37b40721a30fcb/f0620ebe8672a34c#f0620ebe8672a34c As far as I understand it, a new version of Photologue was

Re: Streamlining DJango Deployment — Novel idea from the world of CMSs

2011-09-08 Thread graeme
He wants to be able to emulate the installation of a typical PHP CMS. This is often 1) get database username and poassword, 2) copyfiles to server, 3) navigate to an install URL, 4) fill in db username and password and other config on a set of forms on web page. Installing Django and the app you

Re: Streamlining DJango Deployment — Novel idea from the world of CMSs

2011-09-08 Thread graeme
On Sep 8, 12:45 am, Calvin Spealman wrote: > Can you explain to those of us to whom it is not obvious, what is the > point of this proposal? I don't understand what problem it would > solve. > > > > > > On Wed, Sep 7, 2011 at 10:41 AM, Alec Taylor

Re: Streamlining DJango Deployment — Novel idea from the world of CMSs

2011-09-08 Thread graeme
On Sep 8, 12:45 am, Calvin Spealman wrote: > Can you explain to those of us to whom it is not obvious, what is the > point of this proposal? I don't understand what problem it would > solve. The commonest use case would be something like this: Someone wants to use a Django

Re: Combining queries? A "join" in Python?

2011-09-01 Thread graeme
On Sep 1, 4:48 am, Stuart <stu...@bistrotech.net> wrote: > On Aug 30, 12:10 pm, graeme <graeme.piete...@gmail.com> wrote: > > > > > What my query does is give me a list of subcategories, ordered by > > category, and then by the number of places in the category

Re: Django Development environment

2011-08-31 Thread graeme
I am only supposed to be developing part time (mostly my own sites, occasionally a client), so my choices may not suit everyone (compromises with other needs, and have to be easy to learn). Linux Mint Debian Edition zsh (better history search reduces typing of various manage.py commands etc.)

Re: Django Development environment

2011-08-31 Thread graeme
On Aug 31, 1:16 pm, Jani Tiainen wrote: > On 08/28/2011 12:31 PM, Simon Connah wrote: > > > > > On 28 Aug 2011, at 04:41, Sam Walters wrote: > > >> Debug client-side: > >> firebug, yslow, a windows computer with ie7 > > > Rather than using a separate computer with IE 7 I tend

Re: Combining queries? A "join" in Python?

2011-08-30 Thread graeme
to anyone who has lost track of the models mentioned earlier, the structure is SubCategoryText -> SubCategory -> Category <- CategoryText where -> means "has a foreign key on" and a *Text contains a translation. > > Cheers, > AT > > > > > > > &g

Re: Combining queries? A "join" in Python?

2011-08-30 Thread graeme
On Aug 30, 7:25 pm, Stuart <stu...@bistrotech.net> wrote: > On Aug 30, 3:10 am, graeme <graeme.piete...@gmail.com> wrote: > > > I think I need to restate this question with the actual models. > > Apologies in advance for answering a question you didn't ask, but is

Re: Combining queries? A "join" in Python?

2011-08-30 Thread graeme
it hackish (assuming it works). On Aug 30, 12:02 pm, graeme <graeme.piete...@gmail.com> wrote: > On Aug 30, 6:25 am, Tim <timothyp...@gmail.com> wrote: > > > worst case you could always just write the sql query? > > >https://docs.djangoproject.com/en/dev/topics/db/s

Re: Combining queries? A "join" in Python?

2011-08-30 Thread graeme
els if I do a join in the SQL query. Can it create the models for the joined tables as well? > On Aug 29, 8:15 am, graeme <graeme.piete...@gmail.com> wrote: > > > > > > > > > I looks like my attempt to simplify and abstract the problem just made > > it harder

Re: Combining queries? A "join" in Python?

2011-08-29 Thread graeme
s within the foreign key > lookups.  You may find that you wish to edit your schema relationship, > perhaps by pointing backwards or reversing the relationship.  It is > hard to say with the categorical A, B, C, D example, but hope this > helps and Good Luck! > > On Aug 27, 3:47 pm, Gel

Combining queries? A "join" in Python?

2011-08-27 Thread graeme
I have a some models related link this: A has a foreign key on B which has a foreign key on C I also have D with a foreign key on B, and E with a foreign key of C If I do A.filter(**args).select_related() I will get all the As, Bs, and Cs I want. How do I get the Ds with a foreign key on a B

Re: Easiest way to limit email warnings?

2011-06-20 Thread graeme
Bouterse <bmbou...@gmail.com> wrote: > +1 for django-sentry.  I use it on even the smallest sites and it works > great there too. > > Brian > > > > > > > > > > On Sun, Jun 19, 2011 at 9:17 AM, graeme <graeme.piete...@gmail.com> wrote: > >

Easiest way to limit email warnings?

2011-06-19 Thread graeme
What is the simplest way of preventing the flood of emails that results from a site wide error? I do not want to end up with 10,000 emails because the database was down for an extended period. I do not want to turn it off with ADMINS = () because it is useful for reporting one-off errors. I

Validating or modifying admin inlines against main form

2010-09-28 Thread graeme
I need to do one of the following in the admin using Django 1.2: 1. Validate a value in a form against which objects have been added using an inline form. 2. Add or delete related objects depending on the value in the main model from. The first would be preferable as the user would be able to

Re: Redirect home page

2009-10-11 Thread Graeme Glass
On Oct 11, 12:24 am, Caisys wrote: > Hi, > I would like visitors to my site homepagewww.example.comto be > redirected towww.example.com/en/in order to allow for translations > in the future. > > What is the most efficient way? > > 1- Use apache mod-rewrite? > 2- I know i

Re: order by count of related object

2009-06-30 Thread graeme
This appears to be a new feature. Is there any way of doing this in 1.0? Other than dropping into SQL that is. Graeme On Jun 17, 8:04 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Wed, Jun 17, 2009 at 10:00 AM, R C <rileycr...@gmail.com> wrote: > > > Th