Re: Centos 6.5 Python 3.3.x Django 1.6 Apache 2.2

2014-08-18 Thread John Schmitt
I realise I'm late to this conversation, but I had to do this for my own use 
recently except that I used Centos 7 and Python 3.4.

To do this for me I hacked up a bash script and put it on github:

https://github.com/marmalodak/centos_python3_django_setup/blob/master/mkenv3

I compile both Python 3.4 and mod_wsgi 3.4.

Before posting this message, I replaced the name of the project for which I 
used this script to make it generic.  Please consider it a starting point.

-- 
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/20140818213736.GA3988%40mediapc.snapdragonfly.net.
For more options, visit https://groups.google.com/d/optout.


Re: extremely slow django migrations

2014-09-10 Thread John Schmitt
On Wed, Sep 10, 2014 at 12:08:35PM -0500, Andrew Pinkham wrote:
> Hi Jesse,
...
> Quick heads up: `syncdb` is deprecated in Django 1.7. If you're using Django 
> 1.7, you should first call `makemigrations`, verify the contents of the file, 
> and then call `migrate` to build/alter the database. However, despite 
> deprecation, `syncdb` should not be having an effect on your migration speeds.

Which file?  What do I look for?  What do I 'verify' and to what should it be 
compared?

John

-- 
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/20140910172530.GE12100%40mediapc.snapdragonfly.net.
For more options, visit https://groups.google.com/d/optout.


Re: extremely slow django migrations

2014-09-12 Thread John Schmitt
On Wed, Sep 10, 2014 at 02:06:09PM -0500, Andrew Pinkham wrote:
> On Sep 10, 2014, at 12:25 PM, John Schmitt  wrote:
> > Which file?  What do I look for?  What do I 'verify' and to what should it 
> > be compared?
> 
> When you run `makemigrations app_name`, the output will inform you of the 
> creation of at least one migration file, typically in 
> project_name/app_name/migrations. You may look in this(/these) file(s), and 
> ensure that the changes made are the changes you intended on your models.
> 
> The documentation allows for understanding of the new files:
> 
> https://docs.djangoproject.com/en/1.7/topics/migrations/
> https://docs.djangoproject.com/en/1.7/ref/migration-operations/
> 
> Note that the verification step is entirely optional. The check is not to 
> ensure that migrations work properly. The check is so that you can check that 
> the changes you made in your models are the ones you intended.

I see.  This is exactly what I wanted to know, thank you.

> 
> If you've worked with South, the workflow for working with with native 
> migrations is nearly identical.

I've used Python for years but I'm new to Django so I can't relate to South.  
My references are the official documentation, stackexchange, and this list.

-- 
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/20140912182609.GG12100%40mediapc.snapdragonfly.net.
For more options, visit https://groups.google.com/d/optout.


Re: What is *the* django 1.7 IDE which is opensource & multiplattform

2014-09-24 Thread John Schmitt
On Wed, Sep 24, 2014 at 07:40:51AM -0400, Adam Stein wrote:
> Not sure what you are looking for in terms of Django template support.
> The only difference between pycharm community (free) and commercial in
> terms of Django support that I've noticed is that Django's development
> web server won't restart automatically when code changes in the
> community edition.  Haven't used community edition since last year, but
> I seem to recall, I was still able to have a task to start Django's dev
> web server (in debug mode so I can trace through my code as you'd
> expect), so as long as I restarted that after making changes, things
> were fine.

I've been hearing about pycharm lately, sounds great.  I'm a command line guy 
so I normally ssh to my server where I fire up my editor and hack away.

What do you do with a GUI IDE like pycharm?  That is, how does your 
edit/run/debug cycle work with a pycharm et al?  Can you still edit the 'live' 
files for your django project?

My imagination says that I would sshfs mount the server's file system and then 
pretend that the files I'm editing are local.  Do I still need to ssh to the 
server and manually restart httpd or launch manage.py as needed?

John

-- 
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/20140924190319.GE26562%40mediapc.snapdragonfly.net.
For more options, visit https://groups.google.com/d/optout.


Re: What is *the* django 1.7 IDE which is opensource & multiplattform

2014-09-24 Thread John Schmitt
On Wed, Sep 24, 2014 at 03:43:23PM -0400, Adam Stein wrote:
> On Wed, 2014-09-24 at 12:03 -0700, John Schmitt wrote:
> 
> > On Wed, Sep 24, 2014 at 07:40:51AM -0400, Adam Stein wrote:
> > > Not sure what you are looking for in terms of Django template support.
> > > The only difference between pycharm community (free) and commercial in
> > > terms of Django support that I've noticed is that Django's development
> > > web server won't restart automatically when code changes in the
> > > community edition.  Haven't used community edition since last year, but
> > > I seem to recall, I was still able to have a task to start Django's dev
> > > web server (in debug mode so I can trace through my code as you'd
> > > expect), so as long as I restarted that after making changes, things
> > > were fine.
> > 
> > I've been hearing about pycharm lately, sounds great.  I'm a command line 
> > guy so I normally ssh to my server where I fire up my editor and hack away.
> > 
> > What do you do with a GUI IDE like pycharm?  That is, how does your 
> > edit/run/debug cycle work with a pycharm et al?  Can you still edit the 
> > 'live' files for your django project?
> > 
> > My imagination says that I would sshfs mount the server's file system and 
> > then pretend that the files I'm editing are local.  Do I still need to ssh 
> > to the server and manually restart httpd or launch manage.py as needed?
> > 
> > John
> > 
> 
> 
> Is your server your production machine?  By that, I mean, do you install
> your files somewhere else once you are done making changes to another
> server where it's "officially" used?  I ask because you really don't
> want to be editing live files where "live" means what your customers (or
> yourself) are really using.
> 
> I develop locally, then deploy to a remove server only when changes are
> done and tested.  Therefore, my edit/run/debug cycle with PyCharm
> consists of running Django's web server (./manage.py runserver) on my
> local machine through PyCharm's debugger so that I can step through the
> code.  I also have PyCharm set up to run various unit tests (also useful
> if I need to step through unit test code).  I don't restart httpd,
> because that is running on the remove server and only needs restarting
> when my code is deployed.  In the case of restarting Django's web
> server, PyCharm's professional version ($$$) has the ability to restart
> it for you if you have it running within PyCharm.  For the community
> version, you have to restart it yourself which is as simple as clicking
> a "restart" button.
> 
> If your files live somewhere else, you can mount the file system as
> you've mentioned.  Performance might be better if the files were local,
> but that's true anytime you go across a mounted file system.

I appreciate what you said about deploying and not editing "live" files 
directly.

However, I have several projects in various stages of development and when I 
first start a project, I don't have anything to deploy, I edit everything 
"live".  When it's in production and users are counting on it being up, then I 
would rather not touch the running machine.

When I'm creating a dummy project to test my apache configuration and/or my 
management commands, or trying to assemble a complicated query, I do it "live" 
on the VM on which I created the playground project.  

Another use-case I have is that my workstation is sometimes far removed from my 
development machine.  My workstation is either a Linux machine or sometimes a 
laptop via VPN over wireless.  Tmux and vim/emacs are glorious workhorses for 
this scenario and I have a hard time envisioning that same level of convenience 
from an IDE.  I guess I was hoping that someone had found something magical 
that was at least this convenient.

In case it isn't obvious, I'm a django nub and probably do not know about many 
best practices.

-- 
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/20140924213058.GF26562%40mediapc.snapdragonfly.net.
For more options, visit https://groups.google.com/d/optout.


Re: What is *the* django 1.7 IDE which is opensource & multiplattform

2014-09-24 Thread John Schmitt
On Wed, Sep 24, 2014 at 04:33:35PM -0500, Javier Guerra Giraldez wrote:
> On Wed, Sep 24, 2014 at 4:30 PM, John Schmitt  wrote:
> > When I'm creating a dummy project to test my apache configuration and/or my 
> > management commands, or trying to assemble a complicated query, I do it 
> > "live" on the VM on which I created the playground project.
> 
> 
> why bother with VMs when we have virtualenv?

I put my projects in virtualenvs which are in my VMs.  It's not like one VM can 
only host one project.

Is that what you mean?

-- 
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/20140924215819.GA6737%40mediapc.snapdragonfly.net.
For more options, visit https://groups.google.com/d/optout.


custom query app

2014-11-13 Thread John Schmitt
I have a big django project with multiple apps, models, and the models have 
quite a few fields.

A request came that asked for a page that allows the user to pick and choose 
from the various fields to create their own query.

Does any precedent for this exist?

If I may use a car analogy, a django project that stores info on cars complete 
with many types of engines, car models, interiors, entertainment systems, and 
trim features.  Could I create an app where a user could arbitrarily pick and 
choose fields from each of those models to perform a query on their web 
browser?  One customer could search for cars with V8 engines and DVD players 
and a different customer could search for cars with nylon interiors, no 
entertainment systems and manufactured between dateA and dateB.  The key thing 
is that the customer gets to browse for the available attricutes and add them 
to their query.

The most obvious would be create an app that fixed every possible field and 
appropriate form for each field.  When a model changes and a new field is 
added, simply add another field to this query app.   This is what real estate 
sites seem to do.  I'd like to think there's a more general and elegant way to 
do this.  Is there a general purpose field chooser?

At first I thought that this project would be a good starting point, because he 
kind of implements spreadsheet:

https://github.com/tmu/dimtable

I'm not sure how I can map my problem to that potential solution.

Discussion and wild-eyed ideas welcome.

John

-- 
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/20141113193356.GA22840%40mediapc.snapdragonfly.net.
For more options, visit https://groups.google.com/d/optout.


Re: custom query app

2014-11-14 Thread John Schmitt
On Thu, Nov 13, 2014 at 03:08:01PM -0500, Clifford Ilkay wrote:
> On 11/13/2014 02:33 PM, John Schmitt wrote:
> > I have a big django project with multiple apps, models, and the models have 
> > quite a few fields.
> >
> > A request came that asked for a page that allows the user to pick and 
> > choose from the various fields to create their own query.
> >
> > Does any precedent for this exist?
> 
> Hi John,
> 
> What you're looking for is called "faceted search" or "faceted
> navigation". Django Haystack
> <http://django-haystack.readthedocs.org/en/latest/> is one
> implementation of this.
> 
> -- 
> Regards,
> 
> Clifford Ilkay

Thanks for the help.  With those terms I found 
http://en.wikipedia.org/wiki/Faceted_search so that I can find help online.

This looks interesting, but it might be abandoned:

https://bitbucket.org/magicrebirth/djfacet

John

-- 
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/20141114215351.GB10346%40mediapc.snapdragonfly.net.
For more options, visit https://groups.google.com/d/optout.


Re: ANN: Django website redesign launched

2014-12-17 Thread John Schmitt
Looks nice to me.

Pardon me please for being naive, but will the fonts, colours, and layouts be 
ported to the Django app itself?

That is, will the new layout and colour scheme be available to my Django 1.7 
app if I were to do the following?

$ pip install Django --upgrade

John

-- 
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/20141217224014.GB11643%40mediapc.snapdragonfly.net.
For more options, visit https://groups.google.com/d/optout.


How to create a Django formset with three or more related items?

2015-09-16 Thread John Schmitt
I posted this question on SO, perhaps someone can answer it. http://
stackoverflow.com/questions/32615421/

This Django doc

explains
inline formsets, and uses this nice example:

from django.db import models
class Author(models.Model):
name = models.CharField(max_length=100)
class Book(models.Model):
author = models.ForeignKey(Author)
title = models.CharField(max_length=100)
>>> from django.forms.models import inlineformset_factory>>> BookFormSet = 
>>> inlineformset_factory(Author, Book, fields=('title',))>>> author = 
>>> Author.objects.get(name='Mike Royko')>>> formset = 
>>> BookFormSet(instance=author)

Now, if I add a third model:

class Event(models.Model):
author = models.ForeignKey(Author)
location = model.CharField(max_length=100)

How do I create a formset that allows me to edit all three models? Suppose
there were even more models with a ForeignKey to Author, how do I create a
formset for that? For example,

class Store(models.Model):
author = models.ForeignKey(Author)
store = model.CharField(max_length=100)

There are now three related objects to Author. How do I create a formset
for all four objects?

-- 
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/CALHvOW5BWkFGCvdMwZm36%2BK4A06iG7S27%3DyqreDR6Zc%3DBP-dNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.