Easiest way to access MySQL from Django on Mac OS X?...

2012-09-22 Thread Fred Stluka

Django users,

What's the latest on the easiest way to access MySQL from Django
on Mac OS X 10.6.8 (Snow Leopard)?

I've Googled lots of info, but some may be outdated.  Seems to be
more complicated than it should be, especially since everything else
to do with Django has been so easy.

Here's what I've done and learned:

  - Followed MYSQLdb link in Django docs:
  
https://docs.djangoproject.com/en/1.4/topics/install/#database-installation

to:
  http://sourceforge.net/projects/mysql-python/
and downloaded:
  MySQL-python-1.2.3.tar.gz
  - More info at:  http://mysql-python.sourceforge.net/
  - Confirmed it is not already installed:
% python
  Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43)
  [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
  Type "help", "copyright", "credits" or "license" for more 
information.

>>> import MySQLdb
  Traceback (most recent call last):
File "", line 1, in 
File "MySQLdb/__init__.py", line 19, in 
  import _mysql
  ImportError: No module named _mysql
>>>
  % gunzip MySQL-python-1.2.3.tar.gz
  % tar -xvf MySQL-python-1.2.3.tar
  % less README
- Lots of caveats.  Has to be built and installed.  Looks ugly.
- Says it requires setuptools Python module.
  - Confirmed setuptools is not already installed, by trying the import
 statement that setup.py is going to do:
% python
>>> from setuptools import setup, Extension
  Traceback (most recent call last):
File "", line 1, in 
  ImportError: No module named setuptools
>>>
  % python setup.py build
- Got error, as expected:
Traceback (most recent call last):
  File "setup.py", line 5, in 
from setuptools import setup, Extension
ImportError: No module named setuptools
Exit 1
  % sudo python setup.py install
- No.  Didn't try.  Not yet built.


So now I need setuptools first.  Am I starting down a long dependency
chain of installs, or will this be easy?

I have a Linux server, where it appears that I could use yum to do
a painless install:

  % yum list all | grep -i mysql | grep -i py
MySQL-python.x86_64 1.2.3-0.3.c1.1.8.amzn1  amzn-main

Perhaps there's an easier way for Mac OS X also?  Did some more
Googling and found:

 
http://stackoverflow.com/questions/1448429/how-to-install-mysqldb-python-data-access-library-to-mysql-on-mac-os-x


which is a longish manual set of instructions by an author who wishes
there were a better way, but another reply says to just use MacPorts to
install it.

Any advice?  Thanks!

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Easiest way to access MySQL from Django on Mac OS X?...

2012-09-23 Thread Fred Stluka

Resolved this on my own.  Here's what I did:

- Downloaded and installed MacPorts, but decided not to use it
   because I have too much software already installed that
   MacPorts doesn't know about and wants to reinstall (MySQL,
   Python, OpenSSL, etc.)

- Downloaded and installed Python setuptools and resumed the
   MySQLdb setup that I'd already begun (see my previous post
   appended below).  It turned out to be easy:
   - Download setuptools-0.6c11-py2.7.egg from
  http://pypi.python.org/pypi/setuptools/
   % sh setuptools-0.6c11-py2.7.egg
   % cd MySQL-python-1.2.3
   % python setup.py build
   % sudo python setup.py install

Success!  Now I can access MySQL from my Python/Django apps.

BTW, I also downloaded and installed PyCharm.  Nice Python IDE!

--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 9/22/12 5:28 PM, Fred Stluka wrote:

Django users,

What's the latest on the easiest way to access MySQL from Django
on Mac OS X 10.6.8 (Snow Leopard)?

I've Googled lots of info, but some may be outdated.  Seems to be
more complicated than it should be, especially since everything else
to do with Django has been so easy.

Here's what I've done and learned:

  - Followed MYSQLdb link in Django docs:
https://docs.djangoproject.com/en/1.4/topics/install/#database-installation
to:
http://sourceforge.net/projects/mysql-python/
and downloaded:
  MySQL-python-1.2.3.tar.gz
  - More info at: http://mysql-python.sourceforge.net/
  - Confirmed it is not already installed:
% python
  Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43)
  [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
  Type "help", "copyright", "credits" or "license" for more 
information.

>>> import MySQLdb
  Traceback (most recent call last):
File "", line 1, in 
File "MySQLdb/__init__.py", line 19, in 
  import _mysql
  ImportError: No module named _mysql
>>>
  % gunzip MySQL-python-1.2.3.tar.gz
  % tar -xvf MySQL-python-1.2.3.tar
  % less README
- Lots of caveats.  Has to be built and installed.  Looks ugly.
- Says it requires setuptools Python module.
  - Confirmed setuptools is not already installed, by trying the 
import

 statement that setup.py is going to do:
% python
>>> from setuptools import setup, Extension
  Traceback (most recent call last):
File "", line 1, in 
  ImportError: No module named setuptools
>>>
  % python setup.py build
- Got error, as expected:
Traceback (most recent call last):
  File "setup.py", line 5, in 
from setuptools import setup, Extension
ImportError: No module named setuptools
Exit 1
  % sudo python setup.py install
- No.  Didn't try.  Not yet built.


So now I need setuptools first.  Am I starting down a long dependency
chain of installs, or will this be easy?

I have a Linux server, where it appears that I could use yum to do
a painless install:

  % yum list all | grep -i mysql | grep -i py
MySQL-python.x86_64 1.2.3-0.3.c1.1.8.amzn1  amzn-main

Perhaps there's an easier way for Mac OS X also?  Did some more
Googling and found:

http://stackoverflow.com/questions/1448429/how-to-install-mysqldb-python-data-access-library-to-mysql-on-mac-os-x

which is a longish manual set of instructions by an author who wishes
there were a better way, but another reply says to just use MacPorts to
install it.

Any advice?  Thanks!

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Easiest way to access MySQL from Django on Mac OS X?...

2012-09-23 Thread Fred Stluka

Andrew,

Good info.  Thanks!  I'm hearing lots of good things about Homebrew.
If I go to a package manager, I may try it instead of MacPorts.  For now,
I've succeeded with just installing setuptools and MySQLdb, as described
below, and not re-installing MySQL or Python.

I installed MacPorts, but decided not to use it after doing a dry-run
and seeing that it was planning to re-install a bunch of stuff that it
doesn't know I already have installed and configured:  MySQL,
Python, etc.  Seems like MacPorts is too intrusive if you don't use
it from day one for all Mac installs.  Homebrew would have the
same problem, I guess, as do yum and apt-get on Linux.  It's hard
to start using any of them after a couple years of configuring the
system manually because none of the packages you already
installed are recorded in their records.  I may start using Homebrew
the next time I configure a Mac from scratch, just as I now do all
of my Linux boxes via yum.

For now, I did a manual install of Python setuptools, and then a
manual install of the MySQLdb driver for Python.  Everything's
working fine.  Turned out to be as easy as:
  - Download setuptools-0.6c11-py2.7.egg from
http://pypi.python.org/pypi/setuptools/
  % sh setuptools-0.6c11-py2.7.egg
  - Download MySQL-python-1.2.3.tar.gz from
http://sourceforge.net/projects/mysql-python/
  % gunzip MySQL-python-1.2.3.tar.gz
  % tar -xvf MySQL-python-1.2.3.tar
  % cd MySQL-python-1.2.3
  % python setup.py build
  % sudo python setup.py install

Thanks!
--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 9/23/12 9:54 PM, Andrew Macgregor wrote:

Hi Fred,

I've also found HomeBrew to be useful. Here's a good setup guide:

http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/

Cheers, Andrew.

On Monday, September 24, 2012 2:02:37 AM UTC+8, Fred Stluka wrote:

Resolved this on my own.  Here's what I did:

- Downloaded and installed MacPorts, but decided not to use it
   because I have too much software already installed that
   MacPorts doesn't know about and wants to reinstall (MySQL,
   Python, OpenSSL, etc.)

- Downloaded and installed Python setuptools and resumed the
   MySQLdb setup that I'd already begun (see my previous post
   appended below).  It turned out to be easy:
   - Download setuptools-0.6c11-py2.7.egg from
http://pypi.python.org/pypi/setuptools/
<http://pypi.python.org/pypi/setuptools/>
   % sh setuptools-0.6c11-py2.7.egg
   % cd MySQL-python-1.2.3
   % python setup.py build
   % sudo python setup.py install

Success!  Now I can access MySQL from my Python/Django apps.

BTW, I also downloaded and installed PyCharm.  Nice Python IDE!

--Fred
----
Fred Stluka -- mailt...@bristle.com  --
http://bristle.com/~fred/ <http://bristle.com/%7Efred/>
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
--------

On 9/22/12 5:28 PM, Fred Stluka wrote:

Django users,

What's the latest on the easiest way to access MySQL from Django
on Mac OS X 10.6.8 (Snow Leopard)?

I've Googled lots of info, but some may be outdated.  Seems to be
more complicated than it should be, especially since everything else
to do with Django has been so easy.

Here's what I've done and learned:

  - Followed MYSQLdb link in Django docs:
https://docs.djangoproject.com/en/1.4/topics/install/#database-installation

<https://docs.djangoproject.com/en/1.4/topics/install/#database-installation>
to:
http://sourceforge.net/projects/mysql-python/
<http://sourceforge.net/projects/mysql-python/>
and downloaded:
  MySQL-python-1.2.3.tar.gz
  - More info at: http://mysql-python.sourceforge.net/
<http://mysql-python.sourceforge.net/>
  - Confirmed it is not already installed:
% python
  Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43)
  [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
  Type "help", "copyright", "credits" or "license" for more
information.
>>> import MySQLdb
  Traceback (most recent call last):
File "", line 1, in 
File "MySQLdb/__init__.py", line 19, in 
  import _mysql
  

Re: Easiest way to access MySQL from Django on Mac OS X?...

2012-09-23 Thread Fred Stluka

Chris,

Good info.  Thanks!  I'm hearing lots of good things about Homebrew.
If I go to a package manager, I may try it instead of MacPorts.  For now,
I've succeeded with just installing setuptools and MySQLdb, as described
below, and not re-installing MySQL or Python.

I installed MacPorts, but decided not to use it after doing a dry-run
and seeing that it was planning to re-install a bunch of stuff that it
doesn't know I already have installed and configured:  MySQL,
Python, etc.  Seems like MacPorts is too intrusive if you don't use
it from day one for all Mac installs.  Homebrew would have the
same problem, I guess, as do yum and apt-get on Linux.  It's hard
to start using any of them after a couple years of configuring the
system manually because none of the packages you already
installed are recorded in their records.  I may start using Homebrew
the next time I configure a Mac from scratch, just as I now do all
of my Linux boxes via yum.

For now, I did a manual install of Python setuptools, and then a
manual install of the MySQLdb driver for Python.  Everything's
working fine.  Turned out to be as easy as:
  - Download setuptools-0.6c11-py2.7.egg from
http://pypi.python.org/pypi/setuptools/
  % sh setuptools-0.6c11-py2.7.egg
  - Download MySQL-python-1.2.3.tar.gz from
http://sourceforge.net/projects/mysql-python/
  % gunzip MySQL-python-1.2.3.tar.gz
  % tar -xvf MySQL-python-1.2.3.tar
  % cd MySQL-python-1.2.3
  % python setup.py build
  % sudo python setup.py install

--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 9/23/12 11:03 PM, Chris Streeter wrote:
When I'm setting up a new Mac OS system, the process I go through to 
install Python and MySQL.


First, I install Python using this guide: 
http://docs.python-guide.org/en/latest/starting/install/osx/
The guide also installs Homebrew, which works great for me so far and 
is easily removable.


After Python and Homebrew is installed, then you can install mysql with:

brew install mysql

This will get us the proper headers we need to install MySQLdb with 
pip. After MySQL is installed, you can install MySQLdb into a 
virtualenv or system-wide with a simple command:


pip install MySQLdb

Hope that helps,

- Chris

On Sun, Sep 23, 2012 at 6:54 PM, Andrew Macgregor 
mailto:and...@ccg.murdoch.edu.au>> wrote:


Hi Fred,

I've also found HomeBrew to be useful. Here's a good setup guide:


http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/

Cheers, Andrew.


    On Monday, September 24, 2012 2:02:37 AM UTC+8, Fred Stluka wrote:

Resolved this on my own.  Here's what I did:

- Downloaded and installed MacPorts, but decided not to use it
   because I have too much software already installed that
   MacPorts doesn't know about and wants to reinstall (MySQL,
   Python, OpenSSL, etc.)

- Downloaded and installed Python setuptools and resumed the
   MySQLdb setup that I'd already begun (see my previous post
   appended below).  It turned out to be easy:
   - Download setuptools-0.6c11-py2.7.egg from
http://pypi.python.org/pypi/setuptools/
   % sh setuptools-0.6c11-py2.7.egg
   % cd MySQL-python-1.2.3
   % python setup.py build
   % sudo python setup.py install

Success!  Now I can access MySQL from my Python/Django apps.

BTW, I also downloaded and installed PyCharm.  Nice Python IDE!

--Fred
--------
Fred Stluka -- mailt...@bristle.com --
http://bristle.com/~fred/ <http://bristle.com/%7Efred/>
Bristle Software, Inc -- http://bristle.com -- Glad to be of
service!
Open Source: Without walls and fences, we need no Windows or
Gates.
--------

On 9/22/12 5:28 PM, Fred Stluka wrote:

Django users,

What's the latest on the easiest way to access MySQL from Django
on Mac OS X 10.6.8 (Snow Leopard)?

I've Googled lots of info, but some may be outdated.  Seems to be
more complicated than it should be, especially since
everything else
to do with Django has been so easy.

Here's what I've done and learned:

  - Followed MYSQLdb link in Django docs:

https://docs.djangoproject.com/en/1.4/topics/install/#database-installation
to:
http://sourceforge.net/projects/mysql-python/

Re: Django Tutorial Equivalent to Ruby on Rails Tutorial by Michael Hartl

2012-09-27 Thread Fred Stluka

How current is this book?  Intro says it may not be.  It seems to be
very well-written, but I don't want to be reading stuff that is too old.
I find more recent reference info, as well as good overviews, guides,
etc. at:
https://docs.djangoproject.com/

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 9/26/12 4:07 PM, Jonathan Baker wrote:
I haven't worked through the RoR tutorial you referenced, but 
completing http://www.djangobook.com/en/2.0/index.html gave me all of 
the tools necessary to get projects up and running.


hth,
Jonathan D. Baker

On Wed, Sep 26, 2012 at 1:53 PM, Tommy DANGerous 
mailto:quantumventur...@gmail.com>> wrote:


Hello,

I've been through several tutorials and looked around quite a bit
and haven't really found a solid tutorial that goes through
creating a web app in detail that is on par with the Ruby on Rails
Tutorial by Michael Hartl.

Will you please help a noobie like me and describe some tutorials
for Django. Thank you very much in advance.
-- 
You received this message because you are subscribed to the Google

Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/DN0-dhjpKGoJ.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
<mailto:django-users%2bunsubscr...@googlegroups.com>.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.




--
Jonathan D. Baker
Developer
http://jonathandbaker.com

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: send_mail on MAC OS X 10.7

2012-10-03 Thread Fred Stluka

Cheng,

Yeah, there's probably no need to be running sendmail on the Mac
if you only use it as a client machine, not a server that accepts
incoming mail requests from other machines.  Just configure Django
to use an SMTP server somewhere in the world that you have rights
to use, like smtp.googlemail.com as you do with your Apple Mail
client.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 10/3/12 10:09 AM, Tom Evans wrote:

On Wed, Oct 3, 2012 at 2:39 PM, Cheng  wrote:

Hi Dennis,

I am not familiar with setting up the Mac. How do I check the STMP service
on the Mac?

I am able to send email through the Mac's Mail application though. The
outgoing mail server for the Mail application is smtp.googlemail.com. The
incoming mail server for the Mail application is imap.googlemail.com.

Thanks,
Cheng

If you know the right SMTP server to use, then simply configure django
to use it:

https://docs.djangoproject.com/en/1.4/ref/settings/#email-host

Cheers

Tom



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Edit two related models on one form

2012-10-06 Thread Fred Stluka

Felix,

I'm new to Python and Django, so others may be able to improve
on this, but I had a similar scenario recently and this was my
solution.

I used 2 ModelForms in the same HTML template.  My view method
looks something like (edited to use your question/answer instead
of my original donor/donation objects):


def question_and_answer(request):
"""
Show blank question and answer form, or save question and answer,
or re-show form with errors.

Handles 3 cases:
- Show empty editable form for new questions and answer (GET)
- Save details for new question and answer (POST, valid form)
- Show errors/re-prompt for new question and answer (POST, invalid 
form)


Does not allow edit of existing question or answer.
"""
if request.method == 'POST':
answerform = AnswerForm(request.POST)
questionform = QuestionForm(request.POST)
if questionform.is_valid() and answerform.is_valid():
questionform.save()
answerform.instance.question = questionform.instance
answerform.save()

return HttpResponseRedirect( ... )
else:
answerform = AnswerForm()
questionform = QuestionForm()

return render_to_response(
'question_and_answer.html',
{'answerform': answerform,
 'questionform': questionform,
},
context_instance=RequestContext(request)
)



You'll have to enhance the above to support multiple answers.
Also, to allow editing of existing questions and answers.  I have
code for that scenario too, if you can't figure it out, but this
should get you started.

Anyone else have improvements on this?

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 10/6/12 5:28 PM, Felix Schlitter wrote:

Hello,

I have a pretty basic problem that I cannot find any reference for to 
solve. Let's say I have the following relationship scenario: *question 
*and *answer*, where *each* *question* may have up to *four answers*, 
but *each* *answer* can only have *one question*. I concluded to put a 
/ForeignKey/ on the answer model.


The problem, however, comes when I want to add a new question. 
Currently, I would need to first add a question by itself and 
afterwards create new answers and reference the question. Optimally, I 
would like to be able to create the necessary answers right from the 
question form and associate them with the question upon saving. This 
of course also implies that upon load a form for a certain question, 
the already associated answers will be loaded.


Do I handle the form logic in a ModelForm subclass, on the view or is 
there already pluggable app for this that I missed?


Seems like this scenario would be a pretty common problem,

Felix







--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ikvVkFXPhKUJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help me choose OS for django server

2012-10-30 Thread Fred Stluka

+1 for fail2ban

It's surprising that a 3-year attack eventually succeeded if you
had fail2ban installed, which should have blocked the attack after
just a couple tries.  Or had you not yet learned about fail2ban?
I got hacked once too, before I learned about fail2ban.  Never
since.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 10/30/12 7:09 PM, Trevor Joynson wrote:


I highly recommend fail2ban.

And definitely use SSH key only auth (PasswordAuthentication no).

I've had a box with a 32 char random password get brute forced. Took 
three years to do, but it happened.


On Oct 30, 2012 4:08 PM, "Nikolas Stevenson-Molnar" 
mailto:nik.mol...@consbio.org>> wrote:



> First, is this a good idea?  Do you think I can do this securely
using
> the django, apache, and lighttpd docs? or am I asking for trouble?
>  What are the major security issues I need to be aware of when
> administering a server?
This depends on your specific security requirements. If you're mainly
concerned with protecting your server and website from unwanted
tampering, then the important things are 1) only allow connections to
ports you're using (HTTP) and restrict access via SSH to your IP or a
local network; 2) make sure the software you're using is secure (the
ones you mention are good; though I think Apache is vulnerable to
a type
of DDOS attack: http://en.wikipedia.org/wiki/Slowloris); 3) check your
own code; Django is good about security but that doesn't mean you
can't
build an insecure application with it; 4) choose good passwords, etc.
and if you're particularly concerned, consider using keys for your SSH
connection.

> Also, if I go this route, I'll need to choose an OS.  I'm running a
> production server (just Apache + mod_wsgi) using my Arch Linux box,
> but I don't think arch is the best idea.  I'm sorta trying to decide
> between CentOS and Ubuntu.  Leaning toward CentOS, but just a little
> worried it might be missing some of the packages I need.  I've never
> used CentOS before.  Any advice?
I've used both and haven't noticed much difference for the things
I do.
I would recommend nginx in place of lighttpd (better maintained),
and if
you're using either of those, Apache isn't necessary (though you will
need a WSGI server, such as Gunicorn).

_Nik

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
<mailto:django-users%2bunsubscr...@googlegroups.com>.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help me choose OS for django server

2012-10-30 Thread Fred Stluka

Chris,

Yes, CentOS is a good choice.  You can find all of the packages you
need at the EPEL yum repo.

Some brief articles I've written about security tools I always use:
http://bristle.com/Tips/Unix.htm#logwatch
http://bristle.com/Tips/Unix.htm#fail2ban
http://bristle.com/Tips/Unix.htm#tripwire

and 9 other security tips:
http://bristle.com/Tips/Unix.htm#unix_security

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 10/30/12 3:50 PM, Chris Pagnutti wrote:
Hi.  I want to set up a production server for a django application. 
 constant.com offers Virtual Private Servers which should give me 
virtually full control over the server, allowing me to install django 
and all the stuff I need for my app to run properly.


First, is this a good idea?  Do you think I can do this securely using 
the django, apache, and lighttpd docs? or am I asking for trouble? 
 What are the major security issues I need to be aware of when 
administering a server?


Also, if I go this route, I'll need to choose an OS.  I'm running a 
production server (just Apache + mod_wsgi) using my Arch Linux box, 
but I don't think arch is the best idea.  I'm sorta trying to decide 
between CentOS and Ubuntu.  Leaning toward CentOS, but just a little 
worried it might be missing some of the packages I need.  I've never 
used CentOS before.  Any advice?

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/VmvwRcApvVMJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Location of non-app-specific static files?

2012-11-04 Thread Fred Stluka

Yeah, I do the same with STATIC and COLLECTED_STATIC.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 11/4/12 9:38 AM, Stodge wrote:

I have two project static directories, STATIC and STATIC_FILES. STATIC contains non-app 
specific static files. STATIC_FILES is where static files are "collected".



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: initializing virtualenvwrapper on Mac (10.6.8) for Django

2012-11-06 Thread Fred Stluka

Nice!  Thanks!

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 11/6/12 11:22 AM, Brent wrote:

This guide worked perfectly for me when setting up my dev environment on 
Mountain Lion. (Virtualenv, Virtualwrapper, Homebrew, Xcode, Postgres, Python, 
Django,  etc.)

https://gist.github.com/1852087



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Incorrect Python Version Being Used

2012-11-15 Thread Fred Stluka

Tom,

Excellent article!  Thanks!

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 11/15/12 12:46 PM, Tom Evans wrote:

On Thu, Nov 15, 2012 at 3:49 PM, rh  wrote:

In the djangocon lightning talk there was mention of this disconnect
between "works on runserver" but not in production env.

Not a problem restricted to django. I've been checking out a lot of
frameworks in different languages and most suffer the same malady.
i.e. everything works great locally but hauling it all into a production
env. becomes a project in itself.

It's hard to document because each env. will be different.


This is an interesting problem, which you can work around to a certain
extent. Making predictable and reproducible deployments of code is an
integral part of Software Configuration Management. SCM is a big
topic, so I'm not going to go into crazy details, but here are some
details of how we mitigate these risks at $JOB

1) Use virtualenv and pip

Virtualenv is essential. It allows you to separate the libraries you
use in your deployment from the any other python package. I recommend
using "--no-site-packages" to force virtualenv to ignore any system
site packages, but sometimes it can be necessary.

Pip is the other side of this. Pip is a simple way to specify python
packages to install. You can explicitly reference versions of
packages, or ranges of packages. Eg, "Django>1.4,<1.5" specifies that
the most recent release in the 1.4 cycle is correct. You can also have
a single file that lists all the packages required for your project to
run, usually called 'requirements.txt'. Pip will take that file, and
install all listed packages along with any dependencies.


2) Your project structure is code, and should live in source control.

Your project structure is all the files and folders that make up a
deployment, but aren't actual python code. Eg, if your deployment for
django project 'myproj' looks like this:

.
├── htdocs/
├── logs/
├── project/
│   ├── manage.py
│   └── myproj/
└── scripts/

The 'myproj' directory contains the project source code and is usually
version controlled. However, everything listed there is part of the
project deployment, and changes there must be tracked. If your project
requires a 'logs' directory, then a logs directory must be a versioned
resource that you can check out at any point in it's past.

Just as importantly, any changes that you make in the project
structure in development must be replicated to the production
deployments, and therefore must be tracked.


3) Django apps are also python libraries.

A 'django app', regardless of what it does, is also a python library.
Therefore, make sure you give it a setup.py script using distutils
that will allow you to do standard python library packaging operations
on it. Pip will happily install an app from source control, it will
even install in a manner that allows you to edit and commit changes
back to source control.
This allows you to install packages in development in the same way as
production.


4) Write a bootstrap script.

A bootstrap script is a simple shell script that does two things -
sets up a virtualenv environment, and installs a set of packages.
This combination of storing project structure in source control, using
virtualenv and pip, having a bootstrap script and having a
requirements.txt listing your required packages allows you to simply
checkout a project and run it's bootstrap script to end up with an
identical, repeatable project environment.


6) Use the capabilities of your source control to assemble a deployment

This is the tricky one where I tend to lose people! We use subversion
for source control. Subversion allows us to specify 'externals', which
are secondary subversion repositories that we want to be automatically
checked out in specific locations within another repository. You can
also have 'file externals', which is a single file (rather than an
entire repository tree) that is checked out at a specific location.

The benefit of this is that you can use your project structure
repository as a basis for a deployment on a single site, by
duplicating it for each server that you wish to deploy on.
On each one, you would have an external adding the project source code
in the right place. You would have a file external that pulls in a
'requirements.txt' file correct for this project into the right place.
You would have another file external that pulls in the correct
settings.py (or settings_local.py if that is what you prefer).


7) Use South

Use south for database mi

Re: MySQL Connector/Python Django 1.4

2012-11-22 Thread Fred Stluka

Dilip,

I'm not using MySQL Connector/Python 
<http://dev.mysql.com/downloads/connector/python/>.


I am using:  http://sourceforge.net/projects/mysql-python/

What's the difference?   Is one better than the other?

What platform?  I've installed it on CentOS Linux and on Mac OS X.
I can give you instructions for those platforms.

--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 11/22/12 1:11 PM, Dilip M wrote:

Hi,

Have anyone got MySQL Connector/Python 
<http://dev.mysql.com/downloads/connector/python/> (1.0.7) working 
with Django 1.4?


If yes, what the installation procedure and how to get it work?

Thanks..Dilip
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ANNOUNCE: Django 1.5 released

2013-03-13 Thread Fred Stluka

Good idea!  I donated $100.  Excellent product.  Thanks!

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 2/27/13 12:04 PM, Shawn Milochik wrote:

Ahh, the release of a new version of Django. Always a fantastic time
to support the Django Software Foundation:

https://www.djangoproject.com/foundation/donate/

The money goes to support sprints and other things -- see the donate
page for more details.



--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django dynamic template tag

2013-07-03 Thread Fred Stluka

Fadi,

You need to {% load %} the file that defines the tags.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 7/2/13 8:11 PM, Fadi Samara wrote:


I try to build a plugins based application, I have created tags and 
registered them for each plugin.


I have a table stores each page plugins, and need to render any stored 
plugin in the template accordingly as inclusion tag.


Now for the template i use this:

|{%  block slider_region%}
{%  for  pagecontentin  pagecontents%}
 {%  pagecontent.plugin%}
{%  endfor%}
{%  endblock%}|

But this returns:

|Invalid  block tag:  'pagecontent.plugin',  expected'empty'  or  'endfor'

|

My question, how can I pass the plugin as a tag from view query to a 
template and be rendered as inclusion tag.


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




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: CSRF in javascript

2013-07-20 Thread Fred Stluka

Karl,

Since you already have a form, and are already submitting it
as an Ajax request via JavaScript, the easiest way is to just
put the {% csrf_token %} in the Django template for the page.
We do that for our Ajax forms.

If you are not using a Django template to generate the form,
there are lots of other convenient options.  See:
- https://docs.djangoproject.com/en/dev/ref/contrib/csrf/
and especially:
- https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax

Also, you can find tons of working examples by Googling:
django csrf ajax

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 7/20/13 3:05 PM, Karl Arunachal wrote:

Hi,
In my users page, i have in place editing with ajax. And when i click 
edit, it works fine. But when i submit the form, it don't do anything. 
When i checked, this is the error:

|CSRF verification failed. Request aborted.|
So, how do I place {% csrf_token %} in my javascript? Please advice.

Thank you.
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: CSRF in javascript

2013-07-20 Thread Fred Stluka

Karl,

You are calling render_to_response() wrong.  See the docs at:

https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to-response


Instead of:

variables = RequestContext(request, {
'bookmarks':[bookmark],
'show_edit':True,
'show_tags':True
})
return render_to_response('bookmark_list.html', variables)

try:

variables = {
'bookmarks':[bookmark],
'show_edit':True,
'show_tags':True
}
return render_to_response('bookmark_list.html', 
variables, RequestContext(request))


--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 7/20/13 3:39 PM, Karl Arunachal wrote:
I am sorry, i am really new to this things. Could you please point me 
out as to where I should add it.


_js file:

_function bookmark_edit() {
var item = $(this).parent();
var url = item.find(".title").attr("href");
item.load("/save/?ajax&url=" + escape(url), null, function () {
$("#save-form").submit(bookmark_save);
});
return false;
}

$(document).ready(function () {
$("ul.bookmarks .edit").click(bookmark_edit);
});

function bookmark_save() {
var item = $(this).parent();
var data = {
url: item.find("#id_url").val(),
title: item.find("#id_title").val(),
tags: item.find("#id_tags").val()
};
$.post("/save/?ajax", data, function (result) {
if (result != "failure") {
item.before($("li", result).get(0));
item.remove();
$("ul.bookmarks .edit").click(bookmark_edit);
}
else {
alert("Failed to validate bookmark before saving.");
}
})
return false;
}

_save_form.html:

_
{% csrf_token %}
{{form.as_p}}





_user_page.html:_

{% extends "base.html" %}
{% block external %}


{% endblock %}
{% block title %} {{username}} {% endblock %}
{% block head %} Bookmarks for {{username}} {% endblock %}
{% block content %}
{% include "bookmark_list.html" %}
{% endblock %}


_views.py:_

@login_required(login_url='/login/')
def bookmark_save_page(request):
ajax = request.GET.has_key('ajax')
if request.method == 'POST':
form = BookmarkSaveForm(request.POST)
if form.is_valid():
bookmark = _bookmark_save(request, form)
if ajax:
variables = RequestContext(request, {
'bookmarks':[bookmark],
'show_edit':True,
'show_tags':True
})
return render_to_response('bookmark_list.html', variables)
else:
return HttpResponseRedirect('/user/%s/' % 
request.user.username

)
else:
if ajax:
return HttpResponseRedirect('failure')
elif request.GET.has_key('url'):
url = request.GET['url']
title = ''
tags = ''

try:
link = Link.objects.get(url=url)
bookmark = Bookmark.objects.get(
link=link,
user = request.user
)
title = bookmark.title
tags = ' '.join(
tag.name <http://tag.name> for tag in bookmark.tag_set.all()
)
except ObjectDoesNotExist:
pass
form = BookmarkSaveForm({
'url':url,
'title':title,
'tags':tags
    })
else:
form = BookmarkSaveForm()

variables = RequestContext(request, {
'form': form
})
if ajax:
return render_to_response(
'bookmark_save_form.html',
variables
)
else:
return render_to_response('bookmark_save.html',variables)

Please help me out. Thank you.


On Sun, Jul 21, 2013 at 12:53 AM, Fred Stluka <mailto:f...@bristle.com>> wrote:


Karl,

Since you already have a form, and are already submitting it
as an Ajax request via JavaScript, the easiest way is to just
put the {% csrf

Re: How to force modelForm.is_valid() to use a specific database?

2013-07-23 Thread Fred Stluka

Fellipe,

See:
https://docs.djangoproject.com/en/dev/topics/db/multi-db/

There are a number of ways for force use of a specific database.
You can force it per query, per table, or by any other criteria you
like.  You may need to set up a simple "database router".

--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 7/23/13 2:52 PM, Fellipe Henrique wrote:
The problem is: when usng modelForm, it try to validate the unique key 
in the database, and this validation use a default database.. if I 
remove primary_key=True in my model, work fine, but I need to set the 
pk in my model, because when I try to get using: obj.get(xx)  show me 
error...



I try every think.. and I start to think is not possible multi-db in 
"runtime" in django.. :(


T.·.F.·.A.·. S+F
*Fellipe Henrique P. Soares*

/Blog: http://fhbash.wordpress.com//
/GitHub: https://github.com/fellipeh/
/Twitter: @fh_bash/


2013/7/23 Brian Millham mailto:bmill...@gmail.com>>

I've done that with this code:

if form.is_valid():
  f = form.save(commit = False)
  f.save(using='yourdatabase')


Works fine for me.


On Tuesday, July 23, 2013 1:21:29 PM UTC-4, Fellipe Henrique wrote:

I have many database setted in my setting.py   in my
formModel, when I try to validate the form, show me error:


http://stackoverflow.com/questions/17797419/modelforms-and-multiple-datasbase-error-in-form-is-valid

The problem is.. is_valid is going to "default" database...
how can I force to got to another database?

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
<mailto:django-users%2bunsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: multiple templates fro single view

2013-08-01 Thread Fred Stluka

Can also use render_to_string().

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 8/1/13 9:17 AM, Lukas Nemec wrote:

On 08/01/2013 03:04 PM, Harjot Mann wrote:

On Thu, Aug 1, 2013 at 6:10 PM, Lukas Nemec  wrote:

Well, after some consideration,

result of a view is rendered HTML page which you send to browser,

what do you mean by rendering multiple templates?
are you talking about template inheritance = one root template which 
all

other templates use?

in that case, use {% extends 'root.html' %} tag,
or are you talking about splitting your big template into a few 
smaller?

in that cas, use {% include 'page.html' %} tag

No, I didn;t mean that.
Actually I have a function in views.py file which is hitting an html
file like this:
"return render_to_response('tcc/suspence_bill.html', dict(\
 template.items() + tmp.items()), context_instance =
RequestContext(request))"
here I want to return two html templates from this function.


Hmm. ... alright, how exactly, you have 2 different templates and you 
want to pass context data to both of them, and just append those two 
resulting html together?


so just don't return it

do this:

first try it as debug

html1 = render_to_response(template1 rendering here)
html2 = render_to_response(template 2 rendering)

try to print
print html1
print html2 # so you know if it even is representable as text because 
of http headers etc..


return html1 # or whatever you want

try dir(html1) if it is not a string

or dig into django shortcuts
https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render


Enjoy!
Lukas



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




Re: implement gmail type address adding functionality in django

2013-08-05 Thread Fred Stluka

Roopa,

The word to search is "autocomplete".

Check out:
http://api.jqueryui.com/autocomplete/

It is a JavaScript widget.  We use it with Django.  It runs in our
Web page, and does an Ajax call to our Django code, which
pulls the list of completions from our DB.

--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 8/5/13 6:12 AM, roopasingh...@gmail.com wrote:

Hi,

  What is the name of that technology i want to search in google.

Cheers!


On Monday, August 5, 2013 3:29:21 PM UTC+5:30, JirkaV wrote:

(not on a PC now)

You're looking for quite common functionality - search you
favourite search engine for combination of Django, Ajax and
"typeahead"

HTH

Jirka

*From: * roopas...@gmail.com 
*Sender: * django...@googlegroups.com 
*Date: *Mon, 5 Aug 2013 00:50:06 -0700 (PDT)
*To: *>
*ReplyTo: * django...@googlegroups.com 
*Subject: *implement gmail type address adding functionality in django

I want to implement the functionality available for adding email
address in gmail in my application.

In gmail,in compose mail if we type the 1st character of the email
address,it will show the list of suggested email address.The same
concept,i want to implement in django for contact name.The list of
names are saved in database,so typing any letter of the name,it
should show the list of suggested names and from that user can
select the name.

I need some post or blog to get an idea to do this.


Cheers!

Roopa

-- 
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
<http://groups.google.com/group/django-users>.
For more options, visit https://groups.google.com/groups/opt_out
<https://groups.google.com/groups/opt_out>.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Why is RequestContext used in this way?

2013-11-15 Thread Fred Stluka

Andy,

RequestContext is being passed in so that it become available
to the template, so that it can do things like {% csrf_token %}
which requires access to the session id.

I'm not sure what would happen if a dictionary were passed to
RequestContext as an optional 2nd argument.  I've always
passed the dictionary directly to render_to_response().

--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 11/15/13 7:59 AM, Andrew Taylor wrote:


Hi,

I've followed some example code which is is follows:

def index(request):
context = RequestContext(request)
context_dict =  {'boldmessage': "I am from the context"}
return render_to_response('rango/index.html',context_dict, context)

Here RequestContext only has the first argument filled i.e. request.

My questions are:

1. Is RequestContext(request) being used in a kind of dummy way to 
suck up the context processors for render_to_response?
2. What would render_to_response be doing if has both context_dict AND 
RequestContext had a second argument?


Sorry if these are stupid questions. I'm new to everything python and 
Dango, and the kind of person who forgets everything they have ever 
known when trying to decide which pack of toilet paper to buy in the 
supermarket.


Andy

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9f62f09d-cf92-46e2-893c-17d0a39fe4a5%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/528628C9.5070003%40bristle.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: mod_wsgi setup

2013-11-15 Thread Fred Stluka

tino,

I have a working setup, using Apache mod_wsgi on AWS Linux.

Try adding the location of your virtual env to to your Apache settings.
Something like:

==

WSGIPythonHome /var/python27/virtualenvs/hhl

==

If that doesn't help, here are some more thoughts.

My django.wsgi file looks similar to yours.  Differences in red:

==

import os, sys
sys.path.append('/var/www/django/hhlweb')
sys.path.append('/var/www/django/hhlweb/hhl')
sys.path.append('/var/python27/virtualenvs/hhl/lib/python2.7/site-packages/django/db/backends')
os.environ['DJANGO_SETTINGS_MODULE'] = 'hhl.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

==

What does your wsgi.py file look like?  Mine is:

==

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hhl.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

==

I found these links useful when I set mine up last year:
- http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
- http://code.google.com/p/modwsgi/wiki/ConfigurationIssues
- https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi


--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 11/15/13 8:28 AM, tino wrote:

Thank you guys for the suggestions.

But selinux is already disabled in the server.

 [root@lampserver spark]# getenforce
Disabled

Also I tried to set
 DEBUG = False  in settings.py. That also did not help.


On Friday, November 15, 2013 3:04:58 PM UTC+5:30, tino wrote:

Hello,

I am trying to setup a python 2.7 + Django + virtualenv + mod_wsgi
environment in my centos 6.3 server to run my python application
through apache.
But I am getting internal error while trying to access the
application through apache. The error log shows the following.


[Fri Nov 15 04:20:30 2013] [error] [client 117.201.194.54]
mod_wsgi (pid=20361): Target WSGI script
'/var/www/html/djangosites/spark.wsgi' cannot be loaded as Python
module.
[Fri Nov 15 04:20:30 2013] [error] [client 117.201.194.54]
mod_wsgi (pid=20361): Exception occurred processing WSGI script
'/var/www/html/djangosites/spark.wsgi'.
Fri Nov 15 04:20:30 2013] [error] [client 117.201.194.54]
ImproperlyConfigured: Requested setting DEBUG, but settings are
not configured. You must either define the environment variable
DJANGO_SETTINGS_MODULE or call settings.configure() before
accessing settings.



It is working fine when running as a test server.

==
(virtualenv)[root@lampserver spark]# python manage.py runserver
0.0.0.0:8080 <http://0.0.0.0:8080>
Validating models...

0 errors found
November 15, 2013 - 09:15:19
Django version 1.6, using settings 'spark.settings'
Starting development server at http://0.0.0.0:8080/
Quit the server with CONTROL-C.



spark.wsgi file looks like the following.

===

 import sys
import site
import os

vepath = '/var/www/html/virtualenv/lib/python2.7/site-packages'
prev_sys_path = list(sys.path)
site.addsitedir(vepath)
sys.path.append('/var/www/html/djangosites')
new_sys_path = [p for p in sys.path if p not in prev_sys_path]
for item in new_sys_path:
sys.path.remove(item)
sys.path[:0] = new_sys_path
from django.core.handlers.wsgi import WSGIHandler
os.environ['DJANGO_SETTINGS_MODULE'] = 'spark.settings'
application = WSGIHandler()

==

Entries for wsgi in apache conf looks like the following



[root@lampserver djangosites]# cat /etc/httpd/conf.d/django.conf


LoadModule wsgi_module modules/mod_wsgi.so
AddHandler wsgi-script .wsgi

WSGIScriptAlias / /var/www/html/djangosites/spark.wsgi

WSGIDaemonProcess spark processes=5 threads=15 display-name=%{GROUP}

WSGIProcessGroup spark

WSGIApplicationGroup %{GLOBAL}

WSGISocketPrefix /var/run/wsgi

=

Apache is running as user "apache".

My project files and permissions are shown below.

===
root@lampserver djangosites]# pwd
var/www/html/djangosites
[root@lampserver djangosites]# ls
spark  spark.wsgi
[root@lampserver djangosites]# ll
total 8
drwxr-xr-x 3 apache apache 4096 Nov 15 02:38 spark
-rwxrwxrwx 1 apache apache  535 Nov 15 03:16 

Re: mod_wsgi setup

2013-11-15 Thread Fred Stluka

tino,

Didn't need the WSGIPythonHome setting in Apache, eh?
Interesting...

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 11/15/13 11:24 AM, tino wrote:

Thank you Fred for your help.

Finally I got it working. I tried different things and this is how my 
files looks  now.


spark.wsgi

=

import os
import sys
sys.stdout = sys.stderr
# Add the virtual Python environment site-packages directory to the path
import site
site.addsitedir('/var/www/html/virtualenv/lib/python2.7/site-packages')

#If your project is not on your PYTHONPATH by default you can add the 
following

sys.path.append('/var/www/html/djangosites/spark')
os.environ['DJANGO_SETTINGS_MODULE'] = 'spark.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

==

Apache entries

==

WSGIScriptAlias / /var/www/html/djangosites/spark.wsgi

WSGIDaemonProcess spark processes=5 threads=15 display-name=%{GROUP}

WSGIProcessGroup spark

WSGIApplicationGroup %{GLOBAL}

WSGISocketPrefix /var/run/wsgi



On Friday, November 15, 2013 3:04:58 PM UTC+5:30, tino wrote:

Hello,

I am trying to setup a python 2.7 + Django + virtualenv + mod_wsgi
environment in my centos 6.3 server to run my python application
through apache.
But I am getting internal error while trying to access the
application through apache. The error log shows the following.


[Fri Nov 15 04:20:30 2013] [error] [client 117.201.194.54]
mod_wsgi (pid=20361): Target WSGI script
'/var/www/html/djangosites/spark.wsgi' cannot be loaded as Python
module.
[Fri Nov 15 04:20:30 2013] [error] [client 117.201.194.54]
mod_wsgi (pid=20361): Exception occurred processing WSGI script
'/var/www/html/djangosites/spark.wsgi'.
Fri Nov 15 04:20:30 2013] [error] [client 117.201.194.54]
ImproperlyConfigured: Requested setting DEBUG, but settings are
not configured. You must either define the environment variable
DJANGO_SETTINGS_MODULE or call settings.configure() before
accessing settings.



It is working fine when running as a test server.

==
(virtualenv)[root@lampserver spark]# python manage.py runserver
0.0.0.0:8080 <http://0.0.0.0:8080>
Validating models...

0 errors found
November 15, 2013 - 09:15:19
Django version 1.6, using settings 'spark.settings'
Starting development server at http://0.0.0.0:8080/
Quit the server with CONTROL-C.



spark.wsgi file looks like the following.

===

 import sys
import site
import os

vepath = '/var/www/html/virtualenv/lib/python2.7/site-packages'
prev_sys_path = list(sys.path)
site.addsitedir(vepath)
sys.path.append('/var/www/html/djangosites')
new_sys_path = [p for p in sys.path if p not in prev_sys_path]
for item in new_sys_path:
sys.path.remove(item)
sys.path[:0] = new_sys_path
from django.core.handlers.wsgi import WSGIHandler
os.environ['DJANGO_SETTINGS_MODULE'] = 'spark.settings'
application = WSGIHandler()

==

Entries for wsgi in apache conf looks like the following



[root@lampserver djangosites]# cat /etc/httpd/conf.d/django.conf


LoadModule wsgi_module modules/mod_wsgi.so
AddHandler wsgi-script .wsgi

WSGIScriptAlias / /var/www/html/djangosites/spark.wsgi

WSGIDaemonProcess spark processes=5 threads=15 display-name=%{GROUP}

WSGIProcessGroup spark

WSGIApplicationGroup %{GLOBAL}

WSGISocketPrefix /var/run/wsgi

=

Apache is running as user "apache".

My project files and permissions are shown below.

===
root@lampserver djangosites]# pwd
var/www/html/djangosites
[root@lampserver djangosites]# ls
spark  spark.wsgi
[root@lampserver djangosites]# ll
total 8
drwxr-xr-x 3 apache apache 4096 Nov 15 02:38 spark
-rwxrwxrwx 1 apache apache  535 Nov 15 03:16 spark.wsgi
[root@lampserver djangosites]# cd spark/
manage.py  spark/
[root@lampserver spark]# ll
total 8
-rwxr-xr-x 1 apache apache  248 Nov 15 02:38 manage.py
drwxr-xr-x 2 apache apache 4096 Nov 15 03:05 spark
[root@lampserver spark]# cd spark/
[root@lampserver spark]# ll
total 28
-rw-r--r-- 1 apache apache0 Nov 15 02:38 __init__.py
-rw-r--r-- 1 apache apache  136 Nov 15 02:40 __init__.pyc
-rw-r--r-- 1 apache apache 1969 Nov 15 02:38 setting

Looking for Django consultants near Philadelphia PA...

2013-11-17 Thread Fred Stluka

Django developers,

I have a client near Philadelphia PA that wants to add more Django
consultants to our team.

- Small non-profit company
- Work from home
- Attend weekly status meetings in western Philly suburbs
- Attend frequent cross-training teach/learn sessions with other
   team members in western Philly suburbs
- Full time (30+ hours/week) consultant
- 6+ months

Interested?
--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


--
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/5288B2F5.6040206%40bristle.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Downloading thumbnails and replacing them with full images

2015-01-24 Thread Fred Stluka

+1 for easy-thumbnails.  We use it and it works great.  Allows
the user to upload images, optionally crop them during the
upload, manages the full-size and thumbnail files on the file
system with their names in the DB, etc.  All automatic and all
easy.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 1/24/15 11:25 AM, Larry Martell wrote:

On Fri, Jan 23, 2015 at 7:44 PM, Russell Keith-Magee
 wrote:

On Sat, Jan 24, 2015 at 12:20 AM, Larry Martell 
wrote:

I have a django app that downloads 100's of images. To increase the
performance, I want to change it so that it downloads thumbnails, and
when the user clicks on one then download the full image.

I'm sure I can come up with something on my own (send an ajax request
on click, etc.) but I was wondering if anyone has already done
something like this and knew of any packages or can give any hints or
advice.


My suggestion - look into easy-thumbnails:

http://easy-thumbnails.readthedocs.org/en/latest/index.html

It's an augmentation of Django's ImageField that allows you to store a
"single" image in your model, but also specify policies for how thumbnails
of any image will be generated (in multiple sizes, if needed). The field
will then automatically generate those thumbnails (either on upload, on
demand on download, or in a background process, depending on how you
configure it), and provide an easy way to find the media URL for each
thumbnail (as well as the original).

Thanks very much for the reply Russell. Before I got your message I
found SuperBox which seems to be working for me. But I will keep
easy-thumbnails in mind for the future.

-larry



--
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/54C437E8.2000806%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing Django test client in setUpClass

2015-01-29 Thread Fred Stluka

Nicole,

If you can't access self.client of TestCase, you can always
allocate one yourself as:

c = Client()

See details in:
- http://www.dougalmatthews.com/2010/Jan/20/testing-your-first-django-app/

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 1/22/15 4:08 AM, Nicole Harris wrote:
I just posted this on Stack Overflow and then realised I might have 
more luck here.


Basically, I'd like to know if I can access self.client inside 
setUpClass(cls) when setting up a Django test:

http://stackoverflow.com/questions/28084683/accessing-django-test-client-in-setupclass

If anybody has any insight on this, I'd really appreciate it :)

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/fb4e3cd7-a70a-4a7c-b61f-f6ef73d7e226%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/fb4e3cd7-a70a-4a7c-b61f-f6ef73d7e226%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/54CAAB89.9020002%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Your further steps after tutorial?

2014-08-21 Thread Fred Stluka
I did the tutorial, then created this site for a local non-profit:  
http://helphopelive.org

--Fred

 Original message From: Jorge Andrés Vergara 
Ebratt  Date:8/21/2014  9:55 PM  (GMT-05:00) 
To: django-users@googlegroups.com Subject: Re: Your 
further steps after tutorial? 
After I did the tutorial I joined this list...

After that a friend needed a mobile app, so I told him I was gonna do it, did 
the entire backend with Django and API REST (Django Rest Framework) and a 
friend did the frontend with PhoneGap...

It was hard, but for me, doing is the best way of learning


2014-08-21 18:49 GMT-05:00 Mike Dewhirst :
On 22/08/2014 9:01 AM, Yarick Antonov wrote:
What did you did after you've completed the tutorial
?


I mean, you have basic knowledge of how Django works, what was your
further steps towards becoming Django expert?

That's easy. Build something which will be useful to you. You have two choices:

1. Find an existing Django app and install it and use it. Change it to suit 
your own needs https://www.djangopackages.com/

2. Start from scratch and build it from the ground up.

I prefer #1 but I actually did #2 and essentially relied on the excellent 
Django Admin. Your mileage might vary.

In both cases you need to become familiar with the Django docs because when you 
try something you need to know what you are doing and the docs are the best 
resource. They are great.

Good luck

Mike


I'm asking that because I'm curious what actions people did to become
Django experts, and perhaps I and other beginners can learn something
from it.

--
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/ca7d0bea-e2bd-47d1-8235-d771e3fda188%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/53F6859A.8040605%40dewhirst.com.au.

For more options, visit https://groups.google.com/d/optout.



-- 
Jorge Andres Vergara Ebratt
#SoftwareDeveloper (Or at least trying to be)
@javebratt
facebook.com/javebratt
-- 
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/CAAeX05HrDaBrj54DgXTV%3DkhVTeGxa3BHxF%3DDEsQR7ZPvvJT7hg%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/edsfac3w878k1lecrfd8d31a.1408672977480%40email.android.com.
For more options, visit https://groups.google.com/d/optout.


Error importing dbapi2...

2014-08-25 Thread Fred Stluka

I'm getting error:

django.core.exceptions.ImproperlyConfigured:
Error loading either pysqlite2 or sqlite3 modules
(tried in that order): cannot import name dbapi2

Any suggestions?

Details:

My settings.py contains:
DATABASE = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/Users/fred/fred/HHL/HHLWeb/sqlite3.db'
}
}

Works fine with other DBs (MySQL, MS SQL Server, etc.), but now
I'm trying to switch to SQLite for faster testing.

From the command line, I can see that sqlite3 is installed
(by default as part of the Django install), but seems to not
contain dbapi2:

>>> import sqlite3
>>> from sqlite3 import dbapi2
Traceback (most recent call last):
  File "", line 1, in 
ImportError: cannot import name dbapi2

Any ideas for me?  Any suggestions on how to narrow down
the problem?  Any more info I should give you?

Thanks!
--Fred

--
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/53FB3A82.3060808%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


How quickly do Django unit tests run?...

2014-08-27 Thread Fred Stluka

How quickly do Django unit tests run?

Mine are taking 7-9 seconds each, even for trivial tests like:
self.assertEqual(1 + 1, 2)
that are all in the same test class of the same app.

Is this typical?  Or do I have something misconfigured.

Thanks!
--Fred

--
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/53FDE5E7.6040506%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: How quickly do Django unit tests run?...

2014-08-27 Thread Fred Stluka

Benjamin,

OK, Thanks!  So roughly how fast would you expect?  Hundreds
of trivial tests per minute?  Thousands per minute?

Thanks!
--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 8/27/14 3:57 PM, Benjamin Scherrey wrote:
Something's definitely wrong. Except for the initial setup for the 
test run (in 1.7 migrations run each time for example), the individual 
tests should execute as fast as any normal python unit test.



On Wed, Aug 27, 2014 at 9:06 PM, Fred Stluka <mailto:f...@bristle.com>> wrote:


How quickly do Django unit tests run?

Mine are taking 7-9 seconds each, even for trivial tests like:
self.assertEqual(1 + 1, 2)
that are all in the same test class of the same app.

Is this typical?  Or do I have something misconfigured.

Thanks!
--Fred

-- 
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
<mailto:django-users%2bunsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto: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/53FDE5E7.6040506%40bristle.com.
For more options, visit https://groups.google.com/d/optout.




--
Chief Systems Architect Proteus Technologies <http://proteus-tech.com>
Chief Fan Biggest Fan Productions <http://biggestfan.net>
Personal blog where I am not your demographic 
<http://notyourdemographic.com>.


This email intended solely for those who have received it. If you have 
received this email by accident - well lucky you!!

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/CAHN%3D9D4DNokh2VG47JE9m39FWuR%2Bcc%3D-inUL%3DeRJEr18YHnFRQ%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CAHN%3D9D4DNokh2VG47JE9m39FWuR%2Bcc%3D-inUL%3DeRJEr18YHnFRQ%40mail.gmail.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/53FE3BDE.8020305%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: How quickly do Django unit tests run?...

2014-08-27 Thread Fred Stluka

Ben,

Thanks!  That's exactly the kind of ballpark figure I wanted.

Sounds like I should be expecting roughly 5-10 tests/sec, plus
maybe 10-20 secs DB setup/migration.  I'm currently seeing 1
test per 7-9 secs, plus 50-60 secs DB setup time (syncdb, not
South, since I'm setting SOUTH_TESTS_MIGRATE = False).

Yeah, something must be wrong here.  I'm running 100X slower
than expected.

BTW, are those numbers using SQLite, MySQL, PostgreSQL, other?
So far, I'm using MySQL, running locally on a pretty fast Mac laptop.
I'm planning to switch to SQLite for testing, to make it run faster,
but haven't gotten that to work yet.

My next steps will be try again with SQLite, and perhaps get the
test suite to run in the PyCharm debugger so I can step through
the code and see where all the time is going.

Thanks again!
--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 8/27/14 4:21 PM, Benjamin Scherrey wrote:
Clearly that depends on what your tests do. One of our projects runs 
~400 tests in about a minute. If your tests do much database access or 
have complex setUp/tearDown then that's not going to be as fast of 
course. The Django 1.7 project I'm working on at the moment takes a 
total of 12.7 seconds to complete but most of that time is the setup 
and migrations execution for the test db. Once it starts the 36 tests 
I have now complete in 3.58 seconds in verbose mode with full branch 
coverage turned on.


coverage run --branch --source="partner,item,utils,importing,channel" 
manage.py test --verbosity=2 && coverage report --show-missing


-- Ben


On Thu, Aug 28, 2014 at 3:13 AM, Fred Stluka <mailto:f...@bristle.com>> wrote:


Benjamin,

OK, Thanks!  So roughly how fast would you expect? Hundreds
of trivial tests per minute?  Thousands per minute?

Thanks!
--Fred
----
Fred Stluka -- mailto:f...@bristle.com --
http://bristle.com/~fred/ <http://bristle.com/%7Efred/>
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 8/27/14 3:57 PM, Benjamin Scherrey wrote:

Something's definitely wrong. Except for the initial setup for
the test run (in 1.7 migrations run each time for example), the
individual tests should execute as fast as any normal python unit
test.


On Wed, Aug 27, 2014 at 9:06 PM, Fred Stluka mailto:f...@bristle.com>> wrote:

How quickly do Django unit tests run?

Mine are taking 7-9 seconds each, even for trivial tests like:
self.assertEqual(1 + 1, 2)
that are all in the same test class of the same app.

Is this typical?  Or do I have something misconfigured.

Thanks!
--Fred

-- 
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
<mailto:django-users%2bunsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com
<mailto: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/53FDE5E7.6040506%40bristle.com.
For more options, visit https://groups.google.com/d/optout.




-- 
Chief Systems Architect Proteus Technologies

<http://proteus-tech.com>
Chief Fan Biggest Fan Productions <http://biggestfan.net>
Personal blog where I am not your demographic
<http://notyourdemographic.com>.

This email intended solely for those who have received it. If you
have received this email by accident - well lucky you!!
-- 
You received this message because you are subscribed to the

Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the

Re: Error importing dbapi2 (SOLVED)...

2014-08-29 Thread Fred Stluka

I figured it out.

Details:

I had set environment variable PYTHONPATH to help Django
find the sql_server.pyodbc files needed to make a connection
to a Microsoft SQL Server DB.  This was keeping SQLite from
working properly.  When I cleared the environment variable,
SQLite works fine.

I now get no errors when I do:
>>> import sqlite3
>>> from sqlite3 import dbapi2

and I no longer get the error about dbapi2 when I run my
regression tests via Django.

To get the sql_server.pyodbc file to be found, I now use a
symlink:
% ln -s django/db/backends/sql_server \
~/python/virtualenvs/hhl/lib/python2.7/site-packages/sql_server
instead of setting PYTHONPATH:
% setenv PYTHONPATH 
~/python/virtualenvs/hhl/lib/python2.7/site-packages/django/db/backends


FYI,
--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 8/25/14 9:30 AM, Fred Stluka wrote:

I'm getting error:

django.core.exceptions.ImproperlyConfigured:
Error loading either pysqlite2 or sqlite3 modules
(tried in that order): cannot import name dbapi2

Any suggestions?

Details:

My settings.py contains:
DATABASE = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/Users/fred/fred/HHL/HHLWeb/sqlite3.db'
}
}

Works fine with other DBs (MySQL, MS SQL Server, etc.), but now
I'm trying to switch to SQLite for faster testing.

From the command line, I can see that sqlite3 is installed
(by default as part of the Django install), but seems to not
contain dbapi2:

>>> import sqlite3
>>> from sqlite3 import dbapi2
Traceback (most recent call last):
  File "", line 1, in 
ImportError: cannot import name dbapi2

Any ideas for me?  Any suggestions on how to narrow down
the problem?  Any more info I should give you?

Thanks!
--Fred



--
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/5400CD39.400%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: How quickly do Django unit tests run?...

2014-08-29 Thread Fred Stluka

Benjamin,

I solved my problem.  I switched to SQLite for testing and now
run 500+ tests in 30 secs instead of 75 minutes.  Much better!

Thanks for your help!
--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 8/27/14 5:22 PM, Benjamin Scherrey wrote:

Postgres. best of luck.


On Thu, Aug 28, 2014 at 4:16 AM, Fred Stluka <mailto:f...@bristle.com>> wrote:


Ben,

Thanks!  That's exactly the kind of ballpark figure I wanted.

Sounds like I should be expecting roughly 5-10 tests/sec, plus
maybe 10-20 secs DB setup/migration.  I'm currently seeing 1
test per 7-9 secs, plus 50-60 secs DB setup time (syncdb, not
South, since I'm setting SOUTH_TESTS_MIGRATE = False).

Yeah, something must be wrong here.  I'm running 100X slower
than expected.

BTW, are those numbers using SQLite, MySQL, PostgreSQL, other?
So far, I'm using MySQL, running locally on a pretty fast Mac laptop.
I'm planning to switch to SQLite for testing, to make it run faster,
but haven't gotten that to work yet.

My next steps will be try again with SQLite, and perhaps get the
test suite to run in the PyCharm debugger so I can step through
the code and see where all the time is going.

Thanks again!

--Fred
----
Fred Stluka -- mailto:f...@bristle.com --
http://bristle.com/~fred/ <http://bristle.com/%7Efred/>
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 8/27/14 4:21 PM, Benjamin Scherrey wrote:

Clearly that depends on what your tests do. One of our projects
runs ~400 tests in about a minute. If your tests do much database
access or have complex setUp/tearDown then that's not going to be
as fast of course. The Django 1.7 project I'm working on at the
moment takes a total of 12.7 seconds to complete but most of that
time is the setup and migrations execution for the test db. Once
it starts the 36 tests I have now complete in 3.58 seconds in
verbose mode with full branch coverage turned on.

coverage run --branch
--source="partner,item,utils,importing,channel" manage.py test
--verbosity=2 && coverage report --show-missing

-- Ben


On Thu, Aug 28, 2014 at 3:13 AM, Fred Stluka mailto:f...@bristle.com>> wrote:

Benjamin,

OK, Thanks!  So roughly how fast would you expect?  Hundreds
of trivial tests per minute?  Thousands per minute?

Thanks!
--Fred
    ----
Fred Stluka -- mailto:f...@bristle.com --
http://bristle.com/~fred/ <http://bristle.com/%7Efred/>
Bristle Software, Inc -- http://bristle.com -- Glad to be of
service!
Open Source: Without walls and fences, we need no Windows or
Gates.

On 8/27/14 3:57 PM, Benjamin Scherrey wrote:

Something's definitely wrong. Except for the initial setup
for the test run (in 1.7 migrations run each time for
example), the individual tests should execute as fast as any
normal python unit test.


On Wed, Aug 27, 2014 at 9:06 PM, Fred Stluka
mailto:f...@bristle.com>> wrote:

How quickly do Django unit tests run?

Mine are taking 7-9 seconds each, even for trivial tests
like:
self.assertEqual(1 + 1, 2)
that are all in the same test class of the same app.

Is this typical?  Or do I have something misconfigured.

Thanks!
--Fred

-- 
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
<mailto:django-users%2bunsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com
<mailto: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/

Re: How quickly do Django unit tests run?...

2014-09-02 Thread Fred Stluka

Benjamin,

Thanks for the followup!

I've been using MySQL.  For normal (non-testing) use, it seems
fast enough on our development machines (Mac laptop) and in
our TEST and PROD environments (Linux on AWS).  Page loads
are typically sub-second.  It was only when I used the command:
% python manage.py test
that I saw the long delays.

I assume the delays are related to the default stuff happening in
setUp() and tearDown() for each test.  Still happens with SQLite,
I assume.  Just much faster.  I may step through in the debugger
sometime to confirm this.

I read the slides at the URL you gave me.  Good info!  For now,
our site is fast enough and is not expected to scale dramatically,
but we do have a JIRA ticket for improving performance if/when
we need it.  So far, I've tossed a bunch of idea in there, but not
needed to do any of them:  profiling, caching, file minimization
and packaging, tuning mix of Ajax vs full page loads, etc.
I've added this URL to the JIRA ticket for further consideration
if/when we need it.

Is there a more current version of the slides?  This copy was
presented to OSCON in 2011, and refers to Django 1.3 as new.

Here are some notes I added to our JIRA ticket along with this
URL for if/when we need it:

- Beware ManyToManyField
- Beware over-indexing
- Look into pg_stat_activity (PostgreSQL), or MySQL equivalent
- Prefer NULL to DEFAULT when migrating a large table
   - Or do it 3 steps shown to avoid long lock on DB table
- Consider direct SQL sometimes instead of Django ORM
- Beware iterating over large querysets
- Beware filters with "__in" that match more than 10-15 items
- Beware OFFSET
- Use replication or a backup DB copy for large reporting operations
- Don't use DB as Celery job queue
- Use @commit_on_success or TransactionMiddleware
- Leave autocommit on (even thought it seems wrong)
- Modify tables in a fixed order.  Same for rows of a table.
- Pass QuerySets directly to templates (to allow lazy evaluation)
- Cache templates and fragments
- Cache expensive query results
- Pool DB connections if over 100 concurrent users
- Use db_routers.py to write primary DB, read replica DB

Thanks again!
--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/2/14 5:37 AM, Benjamin Scherrey wrote:
What DB were you testing on before? Unless you're going to launch this 
thing into production with SQLite I would recommend you switch back to 
whatever DB you're planning for production and test with it as you 
probably have some serious performance considerations to work out 
asap. If they're architectural rather than configuration-based issues 
then the sooner you recognize and repair them the better. If you 
happen to be using Postgres out of the box with no changes from your 
distro's base install then it's going to be real slow because 
Postgres' default config is to use as few resources as possible which 
necessarily makes performance less than optimal. It's not hard to make 
Postgres a very fast DB but you better start using it right to make 
things go well when you launch.


See this article for some good advice: 
http://thebuild.com/presentations/unbreaking-django.pdf It's a bit 
dated and newer versions of Django improve on the old implementation 
of the ORM but it's recommendations and things to look out for are 
sound. You need to measure your actual performance and act accordingly.


Good luck,

  -- Ben


On Sat, Aug 30, 2014 at 2:05 AM, Fred Stluka <mailto:f...@bristle.com>> wrote:


Benjamin,

I solved my problem.  I switched to SQLite for testing and now
run 500+ tests in 30 secs instead of 75 minutes.  Much better!

Thanks for your help!

--Fred
    
Fred Stluka -- mailto:f...@bristle.com --
http://bristle.com/~fred/ <http://bristle.com/%7Efred/>
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 8/27/14 5:22 PM, Benjamin Scherrey wrote:

Postgres. best of luck.


On Thu, Aug 28, 2014 at 4:16 AM, Fred Stluka mailto:f...@bristle.com>> wrote:

Ben,

Thanks!  That's exactly the kind of ballpark figure I wanted.

Sounds like I should be expecting roughly 5-10 tests/sec, plus
maybe 10-20 secs DB setup/migration.  I'm currently seeing 1
test per 7-9 secs, plus 50-60 secs DB setup time (syncdb, not
South, since I'm setting SOUTH_TEST

Re: Django 1.5.1 - Mysql - Setting

2014-09-11 Thread Fred Stluka

Ahmed,

For connecting Django to MySQL, I use MySQL-python, installed
via pip as:
pip install MySQL-python

My settings file contains:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME'  : 'name of our database',
'USER'  : 'username to access the database',
'PASSWORD'  : 'password to access the database',
# Required for Windows; Harmless (same as default) for Linux
'HOST'  : '127.0.0.1',
# Required for Windows; Harmless (same as default) for Linux
'PORT'  : '3306',
},

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/11/14 9:34 AM, Muhammad Ahmed wrote:

Hi,

I have been trying to launch my Django Model using a tutorial. but 
unfortunately the tutorial is about Django 1.1.


Kindly guide me that what configuration (in setting.py) will be 
required if I use Python27 / Django 1.5.1 with Mysql.


please also guide towards the appropriate "MySql Adoptor" for Django 
1.5.1.



Thanks in advance :)


Ahmed
--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/881464cf-d4aa-4934-9915-3830ebafd4e6%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/881464cf-d4aa-4934-9915-3830ebafd4e6%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/5411CEF6.7090702%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: What't the best way to track created by and modified by in Django 1.7?

2014-09-17 Thread Fred Stluka

Russ,

Thanks for another classic Russ Magee answer!  As usual, you
are succinct, accurate, relevant, prompt, specific, and very
helpful.

There are an amazing number of helpful people on this list, so
the bar is already pretty high, but you continue to raise it.

Keep up the good work!
--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 9/16/14 7:29 PM, Russell Keith-Magee wrote:

Hi Michael,

There's nothing built into Django 1.7, or any previous version; 
however, it's also not hard to implement yourself. All you have to do 
is override the save method on your model, and in that method, and 
store whatever audit information you want to record. So, for example, 
if you want to just keep a track of the person who most recently 
edited a record, you could do something like:


class MyModel(models.Model):
author = models.ForeignKey(settings.AUTH_USER_MODEL)
... (other fields here)

def save(self, user, *args, **kwargs):
return super(MyModel, self).save(*args, **kwargs)

Then, every time you save an instance of MyModel, you need to pass in 
the user who saved the record; e.g.:


MyModel.objects.save(request.user)

If you want to record a full audit record of every edit, you could do 
that too; you just create a secondary model type, and every time you 
save your base model, you create an instance of the secondary type as 
well.


If you don't want to roll it yourself (or your use case is fairly 
generic), you might find some pre-rolled django apps that can help:


https://www.djangopackages.com/grids/g/versioning/

I can't speak from experience on any of them, but they exist, and you 
might find that one of them meets your needs.


Yours,
Russ Magee %-)

On Tue, Sep 16, 2014 at 10:55 AM, Michael Martin 
mailto:mikemartin...@gmail.com>> wrote:


Hello,

I am sure that I am not the first person to ask this question, but
I want to know the best way to track who created or modified a
record in my settings defined within models.py.  Is there
something new and great added to 1.7 or something that already
exists in older versions?


Thank you 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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto: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/CAD0urK3rTvDdkRnTZcsv_b45pV734JApGFAiY3%2BqFO_%3D1vWkzA%40mail.gmail.com

<https://groups.google.com/d/msgid/django-users/CAD0urK3rTvDdkRnTZcsv_b45pV734JApGFAiY3%2BqFO_%3D1vWkzA%40mail.gmail.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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/CAJxq849xiO%2B51BirpKCWv1EiMKDeuTo1-t26MVWnM1vmvmh7zg%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CAJxq849xiO%2B51BirpKCWv1EiMKDeuTo1-t26MVWnM1vmvmh7zg%40mail.gmail.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/541987B7.60801%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Open Django template in dialog box (not in window)

2014-09-22 Thread Fred Stluka

Kamal,

I do this via the jQueryUI "dialog" widget.  Works fine with Django
or any other back end code.  Just make an Ajax call to the URL
to get the HTML, instead of passing the URL to window.open(),
and pass the HTML to the jQuery dialog widget.

See:  http://jqueryui.com/dialog/

--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/21/14 5:16 AM, Kamal Kaur wrote:

I'm trying to open a Django template using JS as a popup. Actually
I've done this. But it opens a separate window but I want a clean
dialog box or simply a division instead of that window.

Using window.open method, clicking on the "Advance", "popitup"
function runs. Here's the code:
http://pastie.org/9580729

The popitup function takes the passed url and opens a window
containing template sent by the view. But how to open a dialog box
instead?

I've tried using AJAX, like told in the link below but yet unable to do:
http://stackoverflow.com/questions/19267531/how-to-open-jquery-ui-dialog-with-ajax-request




--
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/5420958B.3090905%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there anything similar to phpmyadmin

2014-09-22 Thread Fred Stluka

There's some really nice DB admin functionality in PyCharm.

It's not open source, or even free, and it's not written in Python,
but it's part of an IDE that I use (and many others here?) for
developing our Python/Django code.

Hope this helps!
--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/20/14 9:38 PM, Yuan-Liang Tang wrote:

I'd like to know if there is anything/anyway similar to phpmyadmin for managing 
MySQL DBs in a Django project or in the Python environment. Any suggestions?

django-mysql-manage seems to be dead.

https://pypi.python.org/pypi/django-mysql-manager/0.1.2



--
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/5420960C.509%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Open Django template in dialog box (not in window)

2014-09-23 Thread Fred Stluka

Collin,

Excellent sample.  Thanks!  That's a nice standalone summary
of how to do a popup dialog via jQuery and Ajax.  Worth posting
to a tips page or blog if you have such, so other people can
Google it.

Kamal, does this fill in the gaps for you?  If not, let us know.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/23/14 8:44 AM, Collin Anderson wrote:

# popupadvance.html
|
Here's the worker object: {{ worker }}
|

# views.py
|
defpopupadvance(request):
worker =Worker.objects.get(id=request.GET.get('worker_id')
returnrender(request,'popupadvance.html',{'worker':worker})
|

# urls.py
|
from.importviews
urlpatterns =[
url('popupadvance/$',views.popupadvance)
]
|


|




Advance 



|


|
functionpopitup(url){
  $.ajax({
url:url,
success:function(data){
  $("#dialog-form").load(data).dialog({modal:true}).dialog('open');
}
})
returnfalse;
}
|

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/41199304-7a14-4d20-af30-eebce07e3ac7%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/41199304-7a14-4d20-af30-eebce07e3ac7%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/5421B230.2040201%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can not include jquery in django template

2014-09-23 Thread Fred Stluka

Change it to:

 
</tt><tt>


--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/23/14 2:15 PM, Артём Мутерко wrote:

When I try to include jQuery to my template index.html,



I get an blank page. Html source code is loading but I get just white 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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/793a14fb-c435-4737-92b8-dcd277fb9abb%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/793a14fb-c435-4737-92b8-dcd277fb9abb%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/5421C08A.3020809%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Lightening talk ideas for a (relative) beginner?

2014-09-24 Thread Fred Stluka
 # response status code is 302.
self.assertEqual(response.status_code, 302)
  # Get the choice and check there is now one vote.
  choice = Choice.objects.get(pk=1)
  self.assertEqual(choice.votes, 1)
- No.  Per:
  - https://docs.djangoproject.com/en/1.4/topics/testing
/#default-test-client
  it is even easier.  Just:
  response = self.client.get('/customer/details/')
  - How to mock an Ajax HTTP request:

def test_ajax_vote(self):
c = Client()

# Extra parameters to make this a Ajax style request.
kwargs = {'HTTP_X_REQUESTED_WITH':'XMLHttpRequest'}

# A valid vote
response = c.post('/polls/1/vote/', {'choice': '1',}, 
**kwargs)

self.assertEqual(response.status_code, 200)
self.assertEqual(response.content, '1')

# A invalid vote - choice doesn't exist
response = c.post('/polls/1/vote/', {'choice': '10',}, 
**kwargs)

self.assertEqual(response.status_code, 200)
self.assertEqual(response.content, '0')

# An invalid vote - poll doesn't exist
response = c.post('/polls/2/vote/', {'choice': '1',}, 
**kwargs)

self.assertEqual(response.status_code, 404)

  - Selenium test cases with "LiveServerTestCase":
https://docs.djangoproject.com/en/1.4/topics/testing/#live-test-server
  - Python Nose
  - Django Nose
  - Coverage

Hope this helps!
--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/24/14 2:04 PM, James Brewer wrote:
I want to attend a Django BarCamp in SF next weekend and BarCamp 
tradition is that everyone contribute in some way.


Of course I will help out with set up/break down if that is needed, 
but I would also like to give a lightening talk. I'm fairly unfamiliar 
with Django at this point and I've never spoken publicly, so I am not 
sure what I would talk about.


If anyone has any ideas that would be accessible for someone who is 
relatively new to Django, I would love to hear them. It doesn't have 
to be something I already know as I have a week to familiarize myself, 
but given the short timeline it should be something accessible.


Happy hacking!

James
--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/fa483337-d783-46cb-b140-d15e986a2498%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/fa483337-d783-46cb-b140-d15e986a2498%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/54230EAC.90009%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Open Django template in dialog box (not in window)

2014-09-24 Thread Fred Stluka

Excellent!  Thanks!  Now I can just point my team at it, instead
of writing out the details myself.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/24/14 5:27 PM, Collin Anderson wrote:

Here's the blog post, by popular demand :)

http://collincode.wordpress.com/2014/09/24/jquery-ui-popup-with-django-backend/
--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/dd66d8cb-e5bc-44d9-bae4-7e6383508bc0%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/dd66d8cb-e5bc-44d9-bae4-7e6383508bc0%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/542350E1.2040406%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading Django (to 1.7)

2014-09-25 Thread Fred Stluka

Andrew,

Good stuff!  Thanks!  We're still on 1.4, but planning a move
soon to 1.7.  Very helpful.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/24/14 10:08 PM, Andrew Pinkham wrote:

Hi,
I am writing a series of articles based on the presentation I gave at DjangoCon 
US 2014. I put the first article online earlier today, and figured members of 
this list might be interested in the material.

For all of the material:
 afrg.co/updj17/

For the article:
 afrg.co/updj17/a1/

I plan to post the next three in the series on each of the coming Wednesdays.

Any feedback appreciated. I hope you find the material helpful.

Andrew



--
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/54244DAE.9020900%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading Django (to 1.7)

2014-09-25 Thread Fred Stluka

Sabine,

I'm not sure about the new 1.7 Migrations, but with South,
restarting your migrations is easy.

I'm currently doing it on my project, because we have a
long convoluted history of changes before and after we
started using South, and have made some mistakes along
the way (like editing migrations and fixtures that they use
after running them -- bad idea!).  Since we're at a nice
stable point now, and are certain we'll never need to
migrate back to an earlier version, I'm currently deleting
all the old migrations and creating new clean ones that get
us to our current state.

Steps:

- Delete all rows from south_migrationhistory table.

- For each app
   - Delete old migration files from migrations folders
   - Run: python manage.py convert_to_south /appname/
  to create and fake the 0001_initial.py migration.
  This creates a file in the migrations folder and adds
  row to the south_migrationhistory claiming that the
  migration has already been run.

- For each app with models mapped to DB tables that
   contain data you would want to pre-load into a newly
   created DB (lookup values like countries, states,
   statuses, etc.):
   - Run: python manage.py datamigration /appname/ /migration_name/
  to create a new migration named 0002_/migration_name/.py
  with empty forwards() and backwards() methods.

- For each such DB table:
   - Run: python manage.py dumpdata --indent=4 /appname.ModelName/ > 
.//appname//fixtures//table_name/.default.json

   - Add to forwards() method:
call_command("loaddata", "/table_name/")

--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/25/14 1:11 AM, Sabine Maennel wrote:

Dear Andrew,

I read your article and it is great. I am really looking forward to 
your followups. I was hoping for something like this went I attended 
Django Con Europe. I struggle with the understanding the migrations 
the most. Usually in the early phases of development I do not want 
migrations to bother me since my database design just still changes 
too often for keeping track. I find the django admin a very useful 
tool to test your database design with real data and detect flaws 
early on. So will your followups contain advise on that? How can I 
restart migrations all over once my project is ready for deployment?


Thanks so much for writing these very useful articles! Do you mind if 
I post about them in the Django user facebook user group, or do you 
want to do that, since I think these articles will be very helpful to 
most Django developers.

  with kind regards and keep going!
   Sabine

Am Donnerstag, 25. September 2014 04:09:20 UTC+2 schrieb Andrew Pinkham:

Hi,
I am writing a series of articles based on the presentation I gave
at DjangoCon US 2014. I put the first article online earlier
today, and figured members of this list might be interested in the
material.

For all of the material:
afrg.co/updj17/ <http://afrg.co/updj17/>

For the article:
afrg.co/updj17/a1/ <http://afrg.co/updj17/a1/>

I plan to post the next three in the series on each of the coming
Wednesdays.

Any feedback appreciated. I hope you find the material helpful.

Andrew

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/934a13d6-d5fd-4684-9bb1-e6d323778cda%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/934a13d6-d5fd-4684-9bb1-e6d323778cda%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/542453B6.2070305%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading Django (to 1.7)

2014-09-26 Thread Fred Stluka

Bob,

You can control the order in which migrations run.

For South, see "depends_on" and "needed_by":
- http://south.readthedocs.org/en/latest/dependencies.html

For Django 1.7 migrations, see "dependencies":
- https://docs.djangoproject.com/en/dev/topics/migrations/#dependencies

--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/26/14 9:58 AM, bobhaugen wrote:

Andrew, thanks for the article, and the more-to-come.

When you get to data migrations, you might want to cover a problem I 
ran into with them: when I had a data migration in the middle of a 
sequence of other migrations, and then later wanted to set up a new 
environment, which meant running all of the migrations in sequence 
from the beginning, the data migration was now running in the latest 
models.py code, not the code in which it initially worked. So it did 
not work any more.


In particular, the data migration was a precursor to another schema 
migration were a field would be removed. The data migration was to 
move the existing data in the field-to-be-removed to a different 
field. So when the data migration ran in the longer sequence, the 
field it was trying to move data from was now gone from the code.


I suspect there are a lot of other ways to shoot yourself in the foot 
with data migrations, so we have stopped using them and just use our 
own data migration scripts outside of the sequence of schema migrations.

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/9f4e1b6a-4051-478d-9a09-43318266ed7f%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/9f4e1b6a-4051-478d-9a09-43318266ed7f%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/54258067.1080405%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Fwd: Re: Upgrading Django (to 1.7)

2014-09-27 Thread Fred Stluka

Bob,

Are you referring directly to the models by name in the data
migrations?  That could be the problem, because yes, the migration
would be using the latest models at the time that the migration is
executed, not the models as they stood at the time that the
migration was written.

There's a warning in a comment in the boilerplate code generated
for each data migration by the command:
% manage datamigration  

It says:

def forwards(self, orm):
"Write your forwards methods here."
# Note: Don't use "from appname.models import ModelName".
# Use orm.ModelName to refer to models in this application,
# and orm['appname.ModelName'] for models in other applications.

and there is a dictionary of the models as they existed at that
time shown later in the same file.

If you always follow this advice and manipulate orm.ModelName
instead of appname.models.ModelName, it should solve exactly
the problem you are describing.

Hope this helps,
--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 9/27/14 10:00 AM, bobhaugen wrote:
The problem we ran into was not with the order of migrations, it was 
that all of the migrations were running with the latest models.py 
code. The data migration was trying to move data from one model field 
to another model field, and the "from" field had been deleted from 
models.py.


This was awhile ago, and my memory might be faulty. Do the latest 
migrations give you any way to deal with that situation? I mean, do 
they migrate the models in models.py in sync with the the database 
schema migrations?


I can see where a data migration might work in a schema migration 
sequence if you expressed it all in SQL, just dealing with the 
database alone, but we of course wrote in Python using the Django ORM.


On Friday, September 26, 2014 10:04:49 AM UTC-5, Fred Stluka wrote:

Bob,

You can control the order in which migrations run.

For South, see "depends_on" and "needed_by":
- http://south.readthedocs.org/en/latest/dependencies.html
<http://south.readthedocs.org/en/latest/dependencies.html>

For Django 1.7 migrations, see "dependencies":
-
https://docs.djangoproject.com/en/dev/topics/migrations/#dependencies
<https://docs.djangoproject.com/en/dev/topics/migrations/#dependencies>

--Fred






--
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/5426C996.4050001%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: templates: if and static tags incompatible?

2014-09-29 Thread Fred Stluka

The problem is that static is not being recognized as a valid Django
tag.  Add this line to the top of the template file to define it.

{% load staticfiles %}

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/29/14 12:41 PM, chansonsyiddish wrote:

Hello,

I've got a small problem:

here is the code in my template:

{% if p.fleches %}


{% endif %}

and the django development server tells me:

Django Version: 1.4.5
Exception Type: TemplateSyntaxError
Exception Value:
Invalid block tag: 'static', expected 'elif', 'else' or 'endif'


Is it a bug, or is it really impossible to put a static tag inside an 
if tag?


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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/54298BAD.6030606%40gmail.com 
<https://groups.google.com/d/msgid/django-users/54298BAD.6030606%40gmail.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/54298F84.40103%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading Django (to 1.7)

2014-10-05 Thread Fred Stluka

On 10/1/14 11:36 PM, Andrew Pinkham wrote:

Any feedback appreciated. I hope you find the material helpful.


Andrew,

Excellent 2nd article.  Thanks!

I especially liked the clear explanation of how South migrations
interact badly with initial_data fixtures.  OK to use fixtures, but
load them explicitly via "loaddata" from data migrations. Don't
put them in "initial_data" fixtures.

Also, good explanations of:
- South in general
- The reason why there's a models dictionary (the "frozen model")
   in each migration file, and why to use orm.ModelName
- Differences from Django 1.7 migrations
- How to get started with Django 1.7 migrations
- Unicode vs ASCII issues
- Use of objects.bulk_create()

Thanks!
--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.



--
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/5431D129.60909%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading Django (to 1.7)

2014-10-09 Thread Fred Stluka

On 10/8/14 11:30 PM, Andrew Pinkham wrote:

Hi,
Upgrading Django (to 1.7) Part III: Django 1.7's New Features is now available!

For the article:
   afrg.co/updj17/a3/

For all of the material:
   afrg.co/updj17/

Any feedback appreciated. I hope you find the material helpful.

Andrew


Andrew,

Excellent 3rd article.  Thanks again!

I've recommended it to my team, summarizing it as:
- South vs Django 1.7 Native Migrations
- Upgrading from South to Django 1.7 Native Migrations
- New "App Registry"
- New "System Check Framework"
  -- Invoke via: % python manage.py check
  -- Also runs implicitly as part of most manage.py commands.
  -- Has hooks to add your own checks to enforce project standards, like:
 --- All Models must have a __str__ method.
- New "Custom Querysets"
  -- Often better than writing a custom manager
- Improved prefetch_related()
- New "Custom Lookups"
- Improved form error handling


The App Registry section is not entirely clear to me, probably
because I'm coming from 1.4, not from 1.6.

It might help if you explained how the App Registry relates to
1.4 concepts.  Like, I assume it replaces INSTALLED_APPS, plus
a whole lot more, right?

Otherwise, can you suggest where I can find an article similar to
yours that gets me from 1.4 to 1.5 and on to 1.6 before I use
yours to get me from 1.6 to 1.7?

Thanks!
--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


--
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/543703BF.3040706%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading Django (to 1.7)

2014-10-09 Thread Fred Stluka

Andrew,

Yes, that explains a lot.  I'd recommend including this explanation
in one of the articles of your current series.

BTW, one other thing to keep in mind is that we 1.4 users don't
know what an apps.py file is, so we don't appreciate not having
to create one, since we never did before.

Thanks again!
--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 10/9/14 10:09 PM, Andrew Pinkham wrote:

Hi Fred,
Thanks again for the positive feedback!

I'm sorry I lost you at the App Registry section. I'm afraid I can't recommend 
an article to help with the topic, either. Given your questions, I can see I 
missed the mark. Let me give it another go (warning: this is neither 
technically reviewed nor copy edited).

Django uses the `INSTALLED_APPS` setting to find all of the apps in a project, 
and to build a list of apps to run and use, called an app registry. The way 
Django builds the app registry has changed radically from Django 1.6 to Django 
1.7.

Django 1.6 (and before, but I admit I don't know how far back) used the 
`AppCache` class to maintain a list of these apps. The system was problematic 
because each `AppCache` instance shared state - any change to one `AppCache` 
object lead to a change in all `AppCache` objects. Because of migrations (and 
the need for historical/frozen models), the `AppCache` had to change in Django 
1.7.

Django 1.7 now provides an `Apps` class to be the app registry. Each instance 
is separate from others, allowing the migration system to build historical apps 
and models. You can fetch the `Apps` object (not class!) for your own project 
with:

 from django.apps import apps as django_apps

Referred to as the master registry (the app registry for your project as it 
runs), `django_apps` is an instance of `Apps`, which contains a list of 
`AppConfig` objects.

Starting in Django 1.7 all apps now have an `AppConfig` object attached to 
them. These are built automatically by Django, meaning many developers will be 
able to get away without ever creating an `/app_name/apps.py` file for their 
projects. The ability to override `AppConfig`, however, is quite useful. It 
allows for the implementation of a `ready()` method (seen in the admin 
`AppConfig` subclass) as well as the ability to explicitly set the app label, 
allowing developers to easily rectify namespace conflicts.

Note that we avoid a namespace error thanks to `as django_apps` with 
`AppConfig`. I recommend you do this even if there is no namespace error.

 from django.apps import apps as django_apps
 from . import apps

To deal with this list of `AppConfig` objects (and the models within), all 
`Apps` instances sport a brand new API. We saw it throughout Part II and Part 
III of the article, using it to help us with data migrations and to build our 
checks.

The only trick with `Apps` is that it must be fully built and configured before 
Django can take certain actions, including loading the custom user model, or 
using parts of the translation system. I touched a little bit on it in Part 
III, but plan to expand on it in Part IV.

The bottom line is that the app registry works mostly in the background by 
building a master registry and performing many of its key functions without 
developers ever knowing (just as many developers never knew about Django 1.6's 
`AppCache`). However, understanding the system even a little allows for the 
developer to better edit migrations and create checks, and I suspect that 
interacting with apps via this API will become commonplace.

Fred: Is the above helpful? Feel free to ask more questions.

On Oct 9, 2014, at 4:53 PM, Fred Stluka  wrote:

Otherwise, can you suggest where I can find an article similar to
yours that gets me from 1.4 to 1.5 and on to 1.6 before I use
yours to get me from 1.6 to 1.7?


No, but I hope the process I lay out in Part IV will help you indirectly.

Andrew



--
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/5437445F.6000500%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading Django (to 1.7)

2014-10-17 Thread Fred Stluka

Sounds good!  Thanks!

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 10/15/14 8:17 PM, Andrew Pinkham wrote:

Hi,
Thanks to feedback from Fred and a few others, I've started editing Part III to 
make it more accessible.

Part IV was originally set to be published today. Unfortunately, it is not 
ready to be published.

As soon as the new Part III and Part IV are available, I will let you know.

Thanks,
Andrew



--
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/5440CDDD.6030307%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: createsuperuser tells me its been skipped due to not running in a tty and then tells me i can do it manually by running createsuperuser. Very confused

2014-11-09 Thread Fred Stluka

On 11/8/14 6:54 PM, James Schneider wrote:
If you are running them directly via one-time SSH commands (ie $ ssh 
host 'command'),  note that SSH does not request a full TTY and runs 
everything inside of a channel, which may also pose problems. 

In which case, you can resolve the issue by using ssh -t as
I've often had to do when running sudo via ssh.

See:
- http://bristle.com/Tips/Unix.htm#sudo_via_ssh

--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.



-James

On Nov 8, 2014 2:47 PM, "Andri Sigurðsson" <mailto:faustu...@gmail.com>> wrote:


Ok i'm running this on a cygwin zsh shell.

with python 3.4.1 and Django 1.7.1

I've been running the first app Tutorial on the Django site and
its all been going perfectly right up to this moment and i'm
absolutely stumped.

When i try to run "./manage.py createsuperuser"  it gives me this
error.

"Superuser creation skipped due to not running in a TTY. You can
run `manage.py createsuperuser` in your project to create one
manually."

I havn't been able to find any posts on this particular issue,
 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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto: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/448a6acf-6497-4708-9f28-26d7abad043e%40googlegroups.com

<https://groups.google.com/d/msgid/django-users/448a6acf-6497-4708-9f28-26d7abad043e%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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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%2Be%2BciXdEatKM2MgY11OC57TS%3Do8Am4SrfGrdtomj191%3DGsg3Q%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXdEatKM2MgY11OC57TS%3Do8Am4SrfGrdtomj191%3DGsg3Q%40mail.gmail.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/545F88BF.6070507%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Loading fixtures in Django 1.7

2014-11-09 Thread Fred Stluka

Leonard,

In Django 1.4, you would add this code to the forwards()
method of the migration:

from django.core.management import call_command
call_command("loaddata", "")

--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/9/14 5:46 PM, Leonard Wayne wrote:

I am in the process of upgrading from
Django 1.6 to 1.7.

I have three fixtures.  I am trying to figure
out how I should load them.

One fixture is `initial_data.json`, and I know
that starting with Django 1.7 this special
fixture no longer gets automatically loaded
as it did when we used to run `syncdb` (i.e.,
prior to deprecation in Django 1.7).

So I know all three fixtures should be loaded
the same way as each other, whatever way that
may be.

My main question is:

Should I keep using `loaddata`, as in:

python manage.py loaddata .json

Reading the documentation I get the sense
(though I am not sure) that now the preferred
approach to load fixtures is to create a
migration to perform the loading.  But I
don't see an example of how to do this
process from beginning to end.  It looks
like the process starts with creating an
empty migration, then manually editing the
migration file to define a function like:

def load_data(apps, schema_editor):

But I don't know how to write this function
(`load_data`), and I can't find an 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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/e39e44eb-66c5-4e23-89a5-c2abfae9a6ea%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/e39e44eb-66c5-4e23-89a5-c2abfae9a6ea%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/546052D0.70604%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to test an application that's using a legacy database

2014-11-10 Thread Fred Stluka

David,

No.  You can use it unchanged.  With Django 1.4 at least, and I
assume also with 1.7.

I have a legacy MS SQL Server DB where I have rights to modify
data but not tables.  I also cannot create new DBs in MS SQL
Server.

I used *inspectdb* to create models from the existing DB.

I generally have them marked as *managed=False*, but when
running tests, I have them *managed=True*, and I override the
*DATABASES* settings to point to SQLite, instead of MS SQL Server.
Thus, when I run the tests, the test DB is created in SQLite, and
the real DB server is untouched.

Here's how I do it:

*settings.py:*

DATABASES = { ... the usual stuff ... }

# Decide whether we're running unit tests
RUNNING_UNIT_TESTS = 'test' in sys.argv

if RUNNING_UNIT_TESTS:
DATABASES['default'] = { 'ENGINE': 'django.db.backends.sqlite3', }

*models.py:*

class Meta:
managed = True if settings.RUNNING_UNIT_TESTS else False

--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/10/14 9:43 AM, dpalao.pyt...@gmail.com wrote:

Hi,
I'm writing a Django application that uses an existing database. If I 
understood it well, in such a case one must create non-managed models 
for the legacy tables to avoid Django creating already existing 
tables, right?

For instance, this is how one of my models looks like:

|
classJobInfo(models.Model):
job_db_inx =models.IntegerField(primary_key=True)
id_job =models.IntegerField()
id_user =models.IntegerField()
id_group =models.IntegerField()
account =models.TextField(blank=True)
cpus_req =models.IntegerField()
cpus_alloc =models.IntegerField()
nodelist =models.TextField()
nodes_alloc =models.IntegerField()
partition =models.TextField()
time_start =models.IntegerField()
time_end =models.IntegerField()
was_updated =models.IntegerField()
jobmondatacleared 
=models.IntegerField(db_column='jobMonDataCleared')# Field name made 
lowercase.
endupcount =models.IntegerField(db_column='endUpCount')# Field 
name made lowercase.

approved =models.IntegerField()

classMeta:
managed =False
db_table ='job_info'
|

The problem, of course happens when the unit tests are run. The test 
database must be created when the tests start. But because "managed = 
False", the tables are not created.


First round.
Googling a bit I found a recipe to by-pass this problem: modify the 
DiscoverRunner class (I found it in here 
<http://www.caktusgroup.com/blog/2010/09/24/simplifying-the-testing-of-unmanaged-database-models-in-django/>, 
and tailor it trvially to remove the deprecation warning):


|
classManagedModelDiscoverRunner(DiscoverRunner):
defsetup_test_environment(self,*args,**kwargs):
fromdjango.db.models.loading importget_models
self.unmanaged_models =[m form inget_models()
ifnotm._meta.managed]
form inself.unmanaged_models:
m._meta.managed =True
print("setting %s._meta.managed to True"%(m.__name__,))
super(ManagedModelDiscoverRunner,self).setup_test_environment(*args,**kwargs)

defteardown_test_environment(self,*args,**kwargs):
super(ManagedModelDiscoverRunner,self).teardown_test_environment(*args,**kwargs)
# reset unmanaged models
form inself.unmanaged_models:
m._meta.managed =False

|

So I created a directory in my project called "tests" and put the 
above code in a file called "managed_runner.py" in there. To be more 
explicit, the tree looks like:


|
|--myapp
||--admin.py
||--__init__.py
||--models.py
||--templates
||`-- myapp
|   |   `--home.html
||--tests.py
|`-- views.py
|-- myproj
|   |-- __init__.py
|   |-- settings.py
|   |-- urls.py
|   `--wsgi.py
|--manage.py
`-- tests
|-- __init__.py
`--managed_runner.py

|

Then I modified my "settings.py" file adding

|
TEST_RUNNER="tests.managed_runner.ManagedModelDiscoverRunner"
|

to it. And I ran the tests. Still, it fails:

|
django.db.utils.ProgrammingError:Table'test_db.job_info'doesn't exist
|

But I see the output of print in the screen saying that the models' 
._meta.managed attributes are set to True.



Second round.
Reading the Django docs, I see that DiscoverRunner has a couple of 
interesting methods: setup_databases and teardown_databases. I tried 
to subclass the DiscoverRunner again, this time it looks like:


|
classManagedModelDiscoverRunner(DiscoverRunner):
defsetup_databases(self,**kwargs):
fromdjango.db.models.loading importget_models
self.unmanaged_models =[m form inget_models()ifnotm._meta.managed]
form inself.unmanaged_models:
m._me

Re: HStoreField can't adapt type 'dict'

2014-11-13 Thread Fred Stluka

Collin,

Your answers to so many questions lately have been very
helpful.  Thanks!

Any reason you don't include the original question with your
reply?  Either by top-posting, or by quoting an excerpt?

Would provide context to your answers, making them more
useful, especially to those of us reading them as email, not
at the Google Groups Web site.

Thanks!
--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/12/14 3:36 PM, Collin Anderson wrote:

If anyone runs into this later, here's the ticket with the solution:
https://code.djangoproject.com/ticket/23776
--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/fa827df7-abc4-41f6-b0b7-b947b2638396%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/fa827df7-abc4-41f6-b0b7-b947b2638396%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/5464DC53.2070706%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying Django project

2014-11-20 Thread Fred Stluka

termopro,

I have automated my deployments mostly separate from my
version control.

The other team members and I write, test, commit, and push our
code changes to our Git repo.  I then pull, review, test, update
the version number, commit, tag, and push to Git.

Then I use a shell script (on Mac, but would work on Unix/Linux
also) to push the tagged commit to TEST and later to PROD.

My script does things like:

- Get the latest files from Git before, and back to master after:
   % git checkout mytag
   ...
   % git checkout master

- Create folder of collected static files before, and delete after:
   % mkdir -pv collected_static/mytag
   % python manage.py collectstatic --clear --noinput
   ...
   % rm -rfv collected_static

- Delete all local *.pyc files:
   % find . -name \*.pyc -exec rm -v "{}" ";"

- Insert PROD password into local settings file (PROD pushes
   only) before, and remove after:
   % sed -i .old -e "s/PUT_PROD_PASSWORD_HERE/`cat prod_pw`/g" settings.py
   ...
   % mv -v settings.py.old settings.py

- Show a warning banner at the Web site to say it is going down
   briefly, and clear the banner after:
   % ssh -t myserver.mydomain.com cp -v 
/var/www/django/myapp/templates/myapp/site_alert_maintenance.html 
site_alert.html

   % sleep 60
   ...
   % ssh -t myserver.mydomain.com cp -v 
/var/www/django/myapp/templates/myapp/site_alert_none.html site_alert.html


- Push the local files to the TEST or PROD server:
   %  rsync -v --progress -i -l --rsh=ssh -r --del myapp 
myserver.mydomain.com:/var/www/django


- Run all migrations on the server
   % ssh -t myserver.mydomain.com python manage.py migrate --all

- Stop the Apache server, delete all remote *.pyc files, and
   restart the server:
   % ssh -t myserver.mydomain.com sudo /etc/init.d/httpd stop
   % ssh -t myserver.mydomain.com sudo find /var/www/django/myapp -name 
\*.pyc -exec rm -v "{}" ";"

   % ssh -t myserver.mydomain.com sudo /etc/init.d/httpd start

Plus a few other actions that are specific to our app, and lots
or informational messages, prompts, confirmations, etc.  Also,
some of these steps are combined into a remote script that
runs on the server to reduce the number of "ssh -t sudo"
commands I would otherwise have to do.  But, that's the gist
of it.

Hope this helps!
--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/19/14 5:22 AM, termopro wrote:


I have created a Django 1.7 project and would like to deploy it. I am 
reading about how to do it right and i have some questions.


If i understand correctly deployment should contain the following steps:

1) Initial remote machine set up:

  * a) install os / server / database / cache ...
  * b) install Django and required modules
  * c) update database with real data

2) Upload code/ database changes to remote machine:

  * a) upload changed Django project
  * b) upload changes in Database tables (model migrations)

Most tutorials/articles about deployment do not cover 1.c and 2.b. 
Also the tasks 1.b. and 2.a. are solved using revision control tools 
(Git/Mercurial)


So i'd like to know:

 *

1) How do i install Django project or it's updates without
revision control tools ? Should i simply upload my project using
FTP/SSH ? Is there a good way to automate it ?

 *

2) How do i automate the task of uploading required database
changes (like model migrations) ?

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/e9fb8f5a-2bd9-47d5-80c7-07a3aa82bd25%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/e9fb8f5a-2bd9-47d5-80c7-07a3aa82bd25%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 discuss

Re: Advice needed: Adaptive/Responsive Images in Django?

2014-11-20 Thread Fred Stluka

Right.  Very good article.

The gist is to use the new HTML5 "" and ""
elements along with the "sizes" and "srcset" attributes of
"", and perhaps the CSS3 "calc()" function to specify
multiple sizes of the same image, so the browser only
downloads the right one for the current screen size, all in
a way that falls back to slower but acceptable for older
browsers.

BTW, if you're willing to throw a little JavaScript into the mix,
and not limit yourself to just CSS, you can do truly amazing
things with RWD (Responsive Web Design).  I've been doing
it for about 14 years.  See, for example:
- http://bristle.com/RWD/BrightPanelsDemo/
Drag the window wider and narrower and watch the panels
completely re-configure themselves, nesting/un-nesting,
stacking/un-stacking, hiding/showing, etc.  Anything is
possible.

--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/20/14 8:55 AM, Patrick Beeson wrote:
AListApart recently published a great article on responsive 
images: http://alistapart.com/article/responsive-images-in-practice


On Thursday, November 20, 2014 1:05:45 AM UTC-5, ThomasTheDjangoFan 
wrote:


Hi guys,

do you have a tip for implementing adaptive (responsive) images in
django?

Basically I want to server smaller images to mobile-users and
bigger images to desktop users.
I don't really now about best practices for SEO and
Siteload-Performance.

Are there any apps that you can recon for this?

Thanks a lot for your tips!

Kind regards
Thomas

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/0ea0a557-8043-4bfa-bc2f-23c2561e2245%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/0ea0a557-8043-4bfa-bc2f-23c2561e2245%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/546E80DB.1010503%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying Django project

2014-11-21 Thread Fred Stluka

Mulianto,

You said:
Fred way is good, but need time to type and remember all the steps. 
WIth fabric you will not miss a step and it can be automated.



I think you misunderstood my post.  The commands I showed
are excerpts from my automated script.  I provided them so
termopro could write such a script of his own.  I don't type all
of those commands each time.  I just type: *pub*

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/20/14 7:50 PM, Phang Mulianto wrote:

Hi termopro,

TO automate the deployment, look for fabric + cuisie (CHef like fabric) .

You will bored with the command line in each deployment, and you will 
need fast and standard way of deploying to each new machine.


Fred way is good, but need time to type and remember all the steps. 
WIth fabric you will not miss a step and it can be automated.


Git is you friend here. You can create a private repo in your prod 
machine, and make the code pull from the repo for production 
deployment when you push from dev to prod with hook script (Automate 
again)


BUt make sure the code tested before go production with this way.

Regards,

Mulianto

Blog: http://muliantophang.blogspot.com

On Fri, Nov 21, 2014 at 7:37 AM, Fred Stluka <mailto:f...@bristle.com>> wrote:


termopro,

I have automated my deployments mostly separate from my
version control.

The other team members and I write, test, commit, and push our
code changes to our Git repo.  I then pull, review, test, update
the version number, commit, tag, and push to Git.

Then I use a shell script (on Mac, but would work on Unix/Linux
also) to push the tagged commit to TEST and later to PROD.

My script does things like:

- Get the latest files from Git before, and back to master after:
   % git checkout mytag
   ...
   % git checkout master

- Create folder of collected static files before, and delete after:
   % mkdir -pv collected_static/mytag
   % python manage.py collectstatic --clear --noinput
   ...
   % rm -rfv collected_static

- Delete all local *.pyc files:
   % find . -name \*.pyc -exec rm -v "{}" ";"

- Insert PROD password into local settings file (PROD pushes
   only) before, and remove after:
   % sed -i .old -e "s/PUT_PROD_PASSWORD_HERE/`cat prod_pw`/g"
settings.py
   ...
   % mv -v settings.py.old settings.py

- Show a warning banner at the Web site to say it is going down
   briefly, and clear the banner after:
   % ssh -t myserver.mydomain.com <http://myserver.mydomain.com>
cp -v
/var/www/django/myapp/templates/myapp/site_alert_maintenance.html
site_alert.html
   % sleep 60
   ...
   % ssh -t myserver.mydomain.com <http://myserver.mydomain.com>
cp -v /var/www/django/myapp/templates/myapp/site_alert_none.html
site_alert.html

- Push the local files to the TEST or PROD server:
   %  rsync -v --progress -i -l --rsh=ssh -r --del myapp
myserver.mydomain.com:/var/www/django

- Run all migrations on the server
   % ssh -t myserver.mydomain.com <http://myserver.mydomain.com>
python manage.py migrate --all

- Stop the Apache server, delete all remote *.pyc files, and
   restart the server:
   % ssh -t myserver.mydomain.com <http://myserver.mydomain.com>
sudo /etc/init.d/httpd stop
   % ssh -t myserver.mydomain.com <http://myserver.mydomain.com>
sudo find /var/www/django/myapp -name \*.pyc -exec rm -v "{}" ";"
   % ssh -t myserver.mydomain.com <http://myserver.mydomain.com>
sudo /etc/init.d/httpd start

Plus a few other actions that are specific to our app, and lots
or informational messages, prompts, confirmations, etc. Also,
some of these steps are combined into a remote script that
runs on the server to reduce the number of "ssh -t sudo"
commands I would otherwise have to do.  But, that's the gist
of it.

    Hope this helps!
--Fred

Fred Stluka -- mailto:f...@bristle.com --
http://bristle.com/~fred/ <http://bristle.com/%7Efred/>
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/19/14 5:22 AM, termopro wrote:


I have created a Django 1.7 project and would like to deploy it.
I am reading about how to do it right and i have some questions.

If i 

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

2014-11-24 Thread Fred Stluka

+1 for writing a single RWD (Responsive Web Design) web app
using Django, instead of writing separate web, Android and iOS
apps.

If necessary, wrap the result in PhoneGap to mobile-specific
features, uploading images from the camera, capturing the
GPS location, showing maps, accessing the local file system
and contacts, etc.  But only if you need those features.

My current project uses RWD techniques to look good on
phones, tablets, and full screens.  Lots of jQuery, Ajax, HTML5
and CSS3 for a rich user experience.  Drag any of the pages
wider or narrower to see what I mean:
- http://helphopelive.org

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/24/14 8:37 AM, Collin Anderson wrote:

Hi,

Django can do all of those things except the native android/ios apps. 
Django specializes in websites and especially helpful for handling 
things like logging in, querying a database, processing form input, 
and generating html.


Here are some ways Django can help with your situation:
You could build native android/ios apps and use Django for the server 
side of your app, like how Instagram does it. You could handle the 
desktop side as a website made with Django. If you really wanted 
low-cost-maintenance, you could have your android and ios apps just be 
simple wrappers around a webview that's loading content from Django.


Collin


On Friday, November 21, 2014 9:56:38 AM UTC-5, Mariusz Wilk wrote:

I'm new to programming. Eventually, I'd like to make a website and
an android/ios app that would work together and display pretty
much the same content on a mobile as on the the web. Each client
would log in (via mobile or desktop) and continue solving some
exercises from the place he previously finished at. I have a
potential client for this app, I don't have any deadline and if it
works fine I shouldn't have any problems selling it to him and
getting some commercial experience! So my question is: *what
should I be learning to eventually reach this goal?* I've done a
few Python tutorials/courses online, I played around with HTML,
CSS and JS, right now I'm learning Kivy. Django scared me a lot,
but maybe I should give it another try.

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/e4e4ed98-407b-41c1-841c-0d91eb70de7c%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/e4e4ed98-407b-41c1-841c-0d91eb70de7c%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/54737893.3080604%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Image input missing from POST request

2014-11-26 Thread Fred Stluka

Abhishek,

Good tip about the  syntax!  I didn't realize
you could do that to avoid having to nest the  fields
inside the .

I just looked it up at:
- http://www.w3schools.com/tags/att_input_form.asp
where it says 2 interesting things:
- Not supported in IE
- Can specify multiple forms that the same input field is
   a part of, so presumably, the field would be POSTed with
   any of the listed forms.  Rest of the page does not make
   it obvious how to do that though.  Value is a string of
   space-separated form ids perhaps?

Any comment of either of these 2?  Have you tried your app
on IE?  Have you tried specifying multiple forms?

Thanks!
--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/25/14 11:19 PM, Abhishek Batra wrote:

Hi Collin,

Thanks for taking time out to look at this. It turns out that I 
somehow I copied the rendered HTML wrong! The real problem was that 
the form id used in input was incorrect and this was the reason for 
the file not getting uploaded.


Separately, this is not really a trick but a fairly standard technique 
nowadays, and after correcting my mistake, it works just fine.


Thanks,
Abhishek

On Tuesday, November 25, 2014 7:08:07 AM UTC+5:30, Collin Anderson wrote:

Hi,

I certainly am learning something new about . However, it may be that that trick simply
doesn't work correctly for file fields. My question is: _does_ it
work correctly when the  is a child of the ?

Collin

On Saturday, November 22, 2014 1:21:32 PM UTC-5, Abhishek Batra
wrote:

Hey Donarb,

Input fields are not required to be inside form elements, so
long as they specify the form attribute as I have done. Check
the form attribute here

<https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#Attributes>
for reference.
Moreover, I have other input fields as well which are outside
the form element, but they get successfully submitted.

Any other suggestions anyone?

Thanks,
Abhishek

On Saturday, November 22, 2014 11:03:39 PM UTC+5:30, donarb
wrote:

On Friday, November 21, 2014 7:56:54 PM UTC-8, Abhishek
Batra wrote:

Hi,

This is probably not a Django issue, but just trying
my luck.

I have an |input| field corresponding to a Django
|ImageField| in a Django template. Rendered, the HTML
looks like:

|   method="post"  
   id="profile_form"

   enctype="multipart/form-data">

... (other input fields and elements)
|

The corresponding |View| is an |UpdateView|. I found
|request.FILES| to be empty and
|request.cleaned_data| to contain |'profile_pic': None|.

I used firebug to track the POST data. It contained
other fields but not |profile_pic|.

Can anyone say why the file does not get uploaded?
I've posted this question to StakOverflow

<http://stackoverflow.com/questions/27059357/image-input-missing-from-post-request>
 as
well, in case someone wants reputation points.

Thanks,
Abhishek Batra



The input field is outside the closing  tag so
would not be uploaded as part of the form.

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/aea0cc13-0b33-4734-b59f-a4f06ae12c14%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/aea0cc13-0b33-4734-b59f-a4f06ae12c14%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 gro

Re: Upgrading Django (to 1.7)

2014-11-26 Thread Fred Stluka

Andrew,

Thanks for the shoutout as a reviewer.  Would be better to
link it to my one-many company's corporate site than to
just my links page.  Use:  http://bristle.com

I'm re-posting my privately emailed comments on the latest
version here so people can find them as part of this thread.


Looks good!

You did a great job of explaining the bits that I previously
didn't get:
- Relationship of INSTALLED_APPS to App Registry
- History of the App Registry
- AppCache, Apps, AppConfig
- apps.py
- Custom AppConfig

Also:
- app registry vs. master registry
- label vs. name in AppConfig
- Need for renamed imports
- Exact sed command to change an app's label
- AppConfig.ready()
- autodiscover()
- Apps restrictions (custom user model)

The Check Framework section is now also very clear, and it
seems to be very complete as well.  I like the iterative
approach you use: describing a simple way, then a problem,
then an enhancement that solves the problem, then another
problem, etc.  Nice job!  This will be very useful when I start
using the Check Framework to enforce coding standards for
my team when we move to Django 1.7 or 1.8.


--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/25/14 3:03 PM, Andrew Pinkham wrote:

Hi,
I have just updated Upgrading Django (to 1.7) Part III: Django 1.7's New 
Features. The App Registry and System Check Framework sections have been 
updated to be more accessible.

For the article:
  afrg.co/updj17/a3/

For all of the material:
  afrg.co/updj17/

Part IV will be available before the end of the day!

Andrew



--
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/54762A82.6060507%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading Django (to 1.7)

2014-11-26 Thread Fred Stluka

Andrew,

Part 4 looks great!

Thanks for the shoutout as a reviewer of Part 4.  Like with
Part 3, it would be better to link it to my one-man company's
corporate site than to just my links page.  Use:
http://bristle.com

I'm re-posting my privately emailed comments on the latest
version here so people can find them as part of this thread.


Lots of good advice on how to upgrade, including:
- Tools/resources to use
- Value of having a test suite
- Use of DEV/TEST/PROD and virtualenv
- Importance of going to 1.5, then 1.6, then 1.7, as separate
  steps
- Upgrading packages you depend on
- Upgrading Python itself
- Release notes for each version
  -- Backwards-incompatible changes
  -- Deprecated features
  -- New features
- Use new Check Framework to enforce coding standards
- etc.

See also:
- http://andrewsforge.com/article/upgrading-django-to-17/checklist


Thanks!
--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/25/14 7:16 PM, Andrew Pinkham wrote:

Hi,
Upgrading Django (to 1.7) Part IV: Upgrade Strategies is now available!

For the article:
  afrg.co/updj17/a4/

For all of the material:
  afrg.co/updj17/

I've also provided a checklist of upgrade steps, as well as a list of all the 
links used throughout the series:
  afrg.co/updj17/cl/
  afrg.co/updj17/l/

Any feedback appreciated. I hope you find the material helpful.

Andrew



--
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/54762BF5.80503%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Python/Django programmers needed (telecommute)...

2014-12-04 Thread Fred Stluka

Django programmers,

Interested in a telecommute position for $80-100K/year?

I just forwarded this one to my "Job Wanted" and "Consultants"
mailing lists.  See email appended below.

Also, for anyone local to Philadelphia PA, I expect to be
recruiting onto my own team in about a month or so.
Telecommute with weekly status meetings in Radnor PA,
and ad-hoc local co-working sessions with the dev team.

Interested in either one, please let me know.

--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.



 Forwarded Message 
Subject:Python/Django programmer needed (telecommute)...
Date:   Thu, 4 Dec 2014 18:46:36 -0500 (EST)
From:   f...@bristle.com
To: f...@bristle.com



Job seekers and Consultants,

I'm hesitant to send this one out because I'm going to be trying
to recruit such people onto my own team in another month or so,
and I'd hate to lose the best of you to this guy, but...

It seems like a good offer.  The salary is pretty low, but the
rest of the job description sounds really appealing, and maybe
the right guy can get them to double the salary to get it up to
market rate.  So it would be selfish of me to not at least tell
you about it.

- Senior Python/Django programmer
- Educational software product company, start-up, college portal
  product, successful at one college and rolling it out across the
  country.
- Skills:
  - Python/Django
  - FOSS
  - Agile, demonstrative excellence, code quality, peer code reviews
  - Proficient and proactive communicator both written and oral
  - Python MVC frameworks: Django, Pyramid, Flask
  - Memcached, Celery
  - TDD, PyLint, Nose, Twill, Mechanize, Selenium
  - Jenkins, Bamboo
  - REST, Django-Rest-Framework, Tastypie, Web services
  - Django's ORM, SQLAlchemy, MySQL, PostgreSQL, MongoDB, DynamoDB
  - JSON, HTML5
  - JavaScript, jQuery, Ajax
  - RWD (Responsive Web Design), Bootstrap
  - Cloud, AWS S3, EC2, CloudFront, Route53, CloudFormation
  - Git
  - Redis, MongoDB
  - Salt, Ansible
  - DevOps
  - Node.JS
  - Ember.js, Backbone.js
  - ElasticSearch, Solr, Haystack
- Consultant becoming FTE (right to hire)
- 6+ months
- $80-100K/year
- Telecommute with 1-2 weeks/year onsite in Indianapolis

Interested?  Let me know.

--Fred
-----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
-

Fred,

Thank you for your detailed response and good luck with your project.

I'll attempt to answer your questions and anyone interested can
contact me for more details -- thanks!

Some questions I always ask (some of which were answered
in your attached job description):
- Brief description of the company, what it does, what the
   work environment is like, etc?

Educational software product company, start-up, college portal
product that was successful at one college and rolling it out
across the country.

- Brief description of the responsibilities of the position you
   are trying to fill?

See JD, mid-senior level, some mentoring/coaching of junior
developers

- Technologies used and skills needed?

See JD

- Consultant or FTE?

Consultant at first under my firm, then fulltime with my client

- Full time or part time?

Fulltime

- How long is the initial contract?

6-month contract to hire, more or less based on client preference

- How long is the project likely to run?

Fulltime position after contract

- Approx salary or hourly rate offered?

Salary in the $80-100K for fulltime, some leeway higher if needed,
salary converted to hourly for contract period

- Location (Philly, western suburbs, Wilmington, telecommute, etc.)?

Telecommuting, client is located in Indy, occasional travel to
Indy required but should not exceed 1-2 weeks annually, 1-2 weeks
onsite at start of contract to meet team/etc.



Wow!  That is a REALLY good match for my skills and interests!

I particularly like these aspects (almost everything you described
-- my friends would say you wrote the job description for me
personally):

- Python/Django
- Telecommute
- Demonstrative excellence
- Participation in the open source community
- Provides expert knowledge and guides best practice
- Fanatically documents all code via docstrings and Sphinx
- Increases test coverage via Test Driven Development
- Writes unit tests
- Actively ensures code q

Re: I can't syncdb via django_pyodbc of Django.

2014-12-11 Thread Fred Stluka
 for the location on your operation system):

:::ini
[my_dns_name]
host = my_db_server_name
port = my_db_server_port_number
tds version = 7.0

### Confirm the FreeTDS configuration

tsql -S my_dns_name -D my_db_name -U my_username
Password:
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Default database being set to my_db_name
1>

## Install pyodbc for Mac

2014-07-16 - Fred and Jim found new information for Max OS X

from: 
http://stackoverflow.com/questions/20074620/installing-pyodbc-fails-on-osx-10-9-mavericks


OSX Mavericks dropped sql headers that are required for pyodbc compilation.

Following these steps allowed me to install pyodbc:

1. Install the iODBC library  (http://www.iodbc.org/)
1. Download tar file from website, libiodbc-3.52.9.tar
2. Extract iODBC sources from the tar file.  We extracted into 
directory

   /Users/jim/Downloads/libiodbc-3.52.9
2. Run pip install --allow-external pyodbc --allow-unverified pyodbc 
--no-install pyodbc

3. cd [VIRTUAL_ENV]/build/pyodbc
4. Run  python setup.py build_ext 
--include-dirs=/Users/jim/Downloads/libiodbc-3.52.9/include/

5. Run pip install --no-download pyodbc

 Mac OS X note

The `pyodbc` package that _pip_ installs uses iODBC by default. We want it
to use `unixODBC`, instead, for a couple reasons.

* First, there are numerous sites on the Internet that make claims such as
  "iODBC is a slightly less desirable ODBC manager than unixODBC"
(http://www.cerebralmastication.com/2013/01/installing-debugging-odbc-on-mac-os-x/).
  More people _seem_ to have better luck with `unixODBC`.
* Second, we're using `unixODBC` on Linux, and the configuration is already
  complicated enough. So, why not just use the same approach on both 
platforms?


To get `pyodbc` to use `unixODBC` on the mac, you have to build it from 
source,

and you have to hack the `setup.py`. Here's how to do it.

$ . ~/pythons/hhl/bin/activate
$ cd /tmp
$ git clone https://code.google.com/p/pyodbc
$ cd pyodbc
$ patch >> import pyodbc
>>> conn = pyodbc.connect('DRIVER=SQL Server;'
  'SERVER=my_db_server_name'
  'PORT=my_db_server_port_number;'
  'DATABASE=my_db_name;'
  'UID=my_username;'
  'PWD=my_password')
>>> conn



###

Hope this helps!

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 12/10/14 11:58 AM, pythonista wrote:

I can actually help you here.

I had the same problem and tried 4 different modules.
The only module that works with sql server is

https://github.com/michiya/django-pyodbc-azure


I am running it both on windows and linux, simultaneously.


The settings components are displayed on the web site.

Works like a charm

One dependency is pyodbc to be installed.



On Wednesday, December 10, 2014 4:22:44 AM UTC-5, Sugita Shinsuke wrote:

Hi there.

Could you tell me a good way to use Django with Micro Soft DB SQL server. I 
tried django_pyodbc. Any suggestion is appreciated.

my PC of Environment is below.

Database:
SQL Server 2014 Express

OS:
Windows 7 Home Premium SP1

I used the django module, django_pyodbc.
And, I tried to run syncdb but I couldn't.

My settings.py is below.

DATABASES = {
'default': {
'ENGINE': "django_pyodbc",
'HOST': "localhost",
'USER': "djangouser",
'PASSWORD': "x",
'NAME': "db_test",
'OPTIONS': {
 'host_is_server': True,
 'autocommit': True,
 'unicode_results': True,
 'extra_params': 'tds_version=8.0'
 },
}
}

Things I tried and did not work:
1,change "localhost" to "127.0.0.1,1433" in the HOST property of the code.
2,removed 'OPTIONS'.


However, I tried the module pyodbc of pure python like below. It was fine.

---
conn = pyodbc.connect('driver={SQL 
Server};server=localhost;UID=djangouser;PWD=x;DATABASE=shannon_test;Trusted_Connection=yes')
---

But, DB connection is not established without "Trusted_Connection

Re: Can anyone give me a suggestion or a recommendation as to how I can access the current user's username in the models.py?

2014-12-14 Thread Fred Stluka

Collin and Russell (and anyone else),

Do you have any opinion on this?
- https://bitbucket.org/aptivate/django-current-user

It was offered in an earlier post:
- https://groups.google.com/d/msg/django-users/y7aIbN2_CsA/GtmrSjG1nq8J

as a solution to exactly this problem.

Makes the current user available to the save() method of all
models.

I read the code and it looks good, but I don't know the details
of Apache/WSGI/Django/Python multi-threading well enough
to know if it is thread safe.

It basically uses django.db.models. signals.pre_save.connect()
to get a callback called just before each save(), and that callback
was generated by a middleware layer to know what the current
user was for a request, so it sets a model field with a name like
update_user to the current user just before the save().

If there were 2 concurrent HTTP requests, would this work
reliably?  Or would there just be 2 registered callbacks, that
would overwrite each other's values in the update_user field
before the save()?  If so, one user would be recorded for saves
done by both requests.

It seems to me that this would work fine if each HTTP request
was handled by a separate process, but not if handled by
separate threads that share the same memory, and presumably
the same signals and callbacks.

Thoughts?
--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 12/14/14 2:13 PM, Collin Anderson wrote:

Hi,

The "admin save handlers" refers to save_model() and there's actually 
a nice example of accessing the user.

https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model

If you're using the admin, that's a good place to record this sort of 
thing.


Using a middleware is also helpful for a more general approach, though 
be careful because connections can now be re-used over multiple 
requests. Also, if you're deploying using threading, be sure what you 
are doing is thread-safe.


Collin

On Friday, December 12, 2014 5:29:35 AM UTC-5, malt...@gmail.com wrote:

Thanks Mike and Russell, this is very helpful for starters. Do you
have some more verbose code examples I can use as crutches while I
hobble along the path of understanding Django? Especially an
expansion on something like "All the admin save handlers" would be
much appreciated.

For me every change needs to be tracked, not just ones from the
admin realm, and the audit trail entry is written by a trigger
function which gets the current user name from a variable set for
the postgres connection. My quest so far was to find the magical
place where I have access to the request (for the username) and
the db.connection (for setting the database variable), which – if
I understand correctly – does not exist. So right now I was about
writing my own middleware class with a process_view. Would that be
the right place and how would I introduce the username into the
data flow?


Sincerely,

Malte

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/561482b8-a4bf-44fd-9c7d-ef2bbec54726%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/561482b8-a4bf-44fd-9c7d-ef2bbec54726%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/548E3609.8020509%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: ANN: Django website redesign launched

2014-12-16 Thread Fred Stluka

Jannis,

Care to summarize what has changed?  At first glance, it looks like
mostly the same excellent content and the same sensible
organization of info, with the same useful mechanisms like the
ability to easily flip between different versions of the docs.

Are the changes mostly to do with CSS styles, colors, fonts,
presentation of info?  Or is there a change to the content or the
navigation, as well?

Thanks!
--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 12/16/14 11:09 AM, Jannis Leidel wrote:

Hi everyone,

We're incredibly proud to share with you the new design of the Django website, 
the documentation and the issue tracker.

This is a long time coming and we couldn't be happier to finally ship it :)

As you can imagine, there will be bugs, so please bear with us and report 
issues to the issue tracker at 
https://github.com/django/djangoproject.com/issues

More infos about the redesign and its history can be found in the blog post:

   
https://www.djangoproject.com/weblog/2014/dec/15/announcing-django-website-redesign/

Happy coding, everyone!

Jannis



--
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/54905B00.9070908%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Content using {% include %} not appearing on detailed page Django

2014-12-16 Thread Fred Stluka

Andrew,

I'm not sure, but since no one else has answered yet...

Maybe you can't pass an object as a keyword argument to include,
can only pass strings?  I've done it often with strings, but never
with an object.  Try:

{% include "sidebar.html" title=object.title %}

and in the included file, use simply:

{{title}}

It seems odd that there'd be a restriction like this since I'm sure
you can pass objects to templates from views, but it's worth
trying.  May be a good workaround, or may get you a different
error message that tips you off to what the real problem is.

--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 12/16/14 2:27 PM, Andrew Nguyen wrote:


I'm having some problems getting some of my content to appear on my 
detailed page view, which I have in two separate html files that are 
being pulled in using |{% include %}|. Inside my two files, 
|slider.html|and |sidebar.html|, I'm using tags like 
|{{article.title}}| to grab specific information I need about an article.


*TRIED: *
- Changing syntax in the two included files to |{{object.title}}| did 
not work.


- I've tried doing|{% include "sidebar.html" article=object %}|in 
my|detailed.html|and it did not work. Instead, I would get an 
error|TemplateSyntaxError at /gone-home Unknown argument for 
u'include' tag: u'article=object'.|


- Also tried doing `{% include "sidebar.html" with article=object %} 
did not work either.


*detailed.html*

|
{%  include"sidebar.html"  %}


 {{object.title}}
 {{object.pubDate|date:"l, F j, Y"  }}  |  
{{object.author}}
 
 
 

 {{object.body|linebreaks}}
 

 
 {%  include"slider.html"  %}

|

*slider.html*

|
 
 
 
 {{article.title}}
 
 
 |

*sidebar.html*

|
 {%  for  articlein  object_list|slice:":5"  %}
 
 
 
 
 {{article.title|truncatewords:"4"}}
 
 {%  endfor%}
 |

*models.py*

|from  django.dbimport  models
from  django.core.urlresolversimport  reverse

# Create your models here.
class  FullArticleQuerySet(models.QuerySet):
 def  published(self):
 return  self.filter(publish=True)

class  FullArticle(models.Model):
 title=  models.CharField(max_length=150)
 author=  models.CharField(max_length=150)
 slug=  models.SlugField(max_length=200,  unique=True)
 pubDate=  models.DateTimeField(auto_now_add=True)
 updated=  models.DateTimeField(auto_now=True)
 category=  models.CharField(max_length=150)
 # gameRank = models.PositiveSmallIntegerField(default=0)
 heroImage=  models.CharField(max_length=250,  blank=True)
 relatedImage=   models.CharField(max_length=250,  blank=True)
 body=   models.TextField()
 publish=  models.BooleanField(default=True)

 objects=  FullArticleQuerySet.as_manager()

 def  __str__(self):
 return  self.title

 def  get_absolute_url(self):
 return  reverse("FullArticle_detailed",  kwargs={"slug":  self.slug})

 def  random(self):
 return  
self.get_queryset().order_by('?').values('title','author','heroImage','body').first()

 class  Meta:
 verbose_name=  "Blog entry"
 verbose_name_plural=  "Blog Entries"
 ordering=  ["-pubDate"]|

*views.py*

|from  django.viewsimport  generic
from  .  import  models

# Create your views here.
class  BlogIndex(generic.ListView):
 queryset=  models.FullArticle.objects.published()
 template_name=  "list.html"
 # paginate_by = 2

class  BlogDetail(generic.DetailView):
 model=  models.FullArticle
 template_name=  "detailed.html"|
--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/343cde15-36ab-4432-836b-5947922e48b2%40googlegroups.com 
<https://groups.google.com/d/msgid/dja

Re: Recommendations for hosting service?

2015-01-06 Thread Fred Stluka

+1 for AWS.

Been using it for years.  Keeps getting cheaper and better.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 1/6/15 10:46 AM, Mark Phillips wrote:

+1 for Linode and Digital Ocean.

Also, you can get 2 Virtual Private Servers on AWS EC2  for free for 
the first year.


http://aws.amazon.com/free/ <http://aws.amazon.com/free/>

Mark

On Tue, Jan 6, 2015 at 7:21 AM, claudiomet <mailto:claudio...@gmail.com>> wrote:


I have digitalocean and no problems

2015-01-06 11:05 GMT-03:00 Vijay Khemlani mailto:vkhem...@gmail.com>>:

I like Linode, and DigitalOcean is also a great choice.

Both require low-level configuration of the server but I
prefer that over the pre-packaged solutions.

On Tue, Jan 6, 2015 at 10:44 AM, Brad Rice
mailto:bradri...@gmail.com>> wrote:

I like webfaction, too. I think they would have all the
stuff you list as well as more.

On Tuesday, January 6, 2015 6:30:18 AM UTC-5, Bobby
Mozumder wrote:

Anyone have recommendations for hosting services that
can do Django, Node.js, Postgreqsl, python3, as well
as PHP/MySQL for legacy stuff?  I’m also looking to
have IMAP email. This would be for several domains,
with maybe 100GB of data.

-bobby

-- 
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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com
<mailto: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/1c61b6c7-ae41-48fa-a2f1-2eb1b8a7ea68%40googlegroups.com

<https://groups.google.com/d/msgid/django-users/1c61b6c7-ae41-48fa-a2f1-2eb1b8a7ea68%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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com
<mailto: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/CALn3ei2Vh-OmGWYd25-fL829cokjKLvcF59EV0nvpk7E%2BQEd5g%40mail.gmail.com

<https://groups.google.com/d/msgid/django-users/CALn3ei2Vh-OmGWYd25-fL829cokjKLvcF59EV0nvpk7E%2BQEd5g%40mail.gmail.com?utm_medium=email&utm_source=footer>.


For more options, visit https://groups.google.com/d/optout.




-- 
Claudio Cortes N.

Project Engineer
Environmental Area
MICOMO S.A.
Tel: +56 (2) 22400516 
Cel: +56 (9) 65871064 
ccor...@micomo.cl <mailto:ccor...@micomo.cl>
www.micomo.cl <http://www.micomo.cl>
Antonio Rabat Sur 6165, Vitacura
Región Metropolitana, Chile
-- 
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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto: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/CABWjCh3rsr23aw2LwhJPcO3SkR_FG3_Ct4VPAAUdi9iz97WBfQ%40mail.gmail.com

<https://groups.google.com/d/msgid/django-users/CABWjCh3rsr23aw2LwhJPcO3SkR_FG3_Ct4VPAAUdi9iz97WBfQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.


For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are sub

Re: How mature is Microsoft SQL Server support by the ORM?

2013-11-21 Thread Fred Stluka

Clifford,

I use:
- http://code.google.com/p/django-pyodbc/

No problem except that the MS SQL Server DB identifies itself
as using UTF-8, but actually contains Windows-1252 chars, so
we get UnicoeDecodeError a lot and have to repair the data.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 11/21/13 1:28 PM, Larry Martell wrote:
On Thu, Nov 21, 2013 at 1:20 PM, CLIFFORD ILKAY 
mailto:clifford_il...@dinamis.com>> wrote:


Hello,

There is an upcoming project where support for an existing application
where Microsoft SQL Server is being used. Switching to another
database
is not an option. There are hundreds of custom reports that the users
have created with Crystal Reports. I found django-sqlserver
<https://pypi.python.org/pypi/django-sqlserver>. The latest version of
SQL Server it supports is 2008r2, which would be a problem given that
some sites are already running newer versions. How mature is this? Are
there any limitations or show-stoppers that you're aware of?


I've been trying to get Vernon Cole's django-mssql package working 
(https://bitbucket.org/vernondcole/django-mssql-ado-merge) but I have 
not been successful. I messed around with this for a month, and then I 
stopped working on it. I plan to look at it again next week. I hadn't 
seen the package you mention. I'll check it out.

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY7PPvkEri30ERLG%3DwpV27-u4VCtF8v4ALucq2qwnQnY-g%40mail.gmail.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/528EE05E.2090700%40bristle.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How mature is Microsoft SQL Server support by the ORM?

2013-11-22 Thread Fred Stluka

Clifford,

Yes, its because the legacy DB has Windows-1252 chars in it, but
mis-informs Django that it is all UTF-8 chars.

Not a problem with django-pyodbc, which seems to work perfectly.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 11/22/13 1:46 PM, CLIFFORD ILKAY wrote:

On 11/21/2013 11:41 PM, Fred Stluka wrote:

Clifford,

I use:
- http://code.google.com/p/django-pyodbc/

No problem except that the MS SQL Server DB identifies itself
as using UTF-8, but actually contains Windows-1252 chars, so
we get UnicoeDecodeError a lot and have to repair the data.


Hi Fred,

Is that because you had a legacy database with Windows-1252 characters 
in them? In other words, is this because of the data or because of 
django-pyodbc?

--
Regards,

Clifford Ilkay

647-778-8696

Dinamis

<http://dinamis.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/528FA684.3000202%40dinamis.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/528FFE00.2090105%40bristle.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Email Templates and the full website URL

2013-11-30 Thread Fred Stluka

I had the same problem.  Wrote this:

def get_web_server_base_url(request, settings_override_name=None):
# Allow the value in the settings file to override any computed value.
url = None
if settings_override_name:
url = getattr(settings, settings_override_name, None)
if not url:
protocol = request.is_secure() and 'https' or 'http'
host = request.get_host()
url = "{0}://{1}".format(protocol, host)
return url

I didn't know about Site or RequestSite at the time.  Perhaps I could
have used them, but:

1. I wanted the protocol (http, or https) to be correct also.  Would
RequestSite have done that for me?

2. I wanted to be able to override the hostname with the primary
name of the server (via an entry in settings.py) even if the request
was sent to a secondary name or the IP address of the server.
I suppose Site would have allowed this, via storing the name in
the DB, but that seems like more work than a settings.py file,
especially since I already have convenient mechanism to manage
different settings.py files when deployed on different servers.

Thoughts?

--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 11/29/13 6:09 AM, Vibhu Rishi wrote:
Thanks for the links. I had done the google searches and gone through 
them, but they seemed to me a lot of work to get something simple.


I finally did the following. Any comments welcome if this is not a 
good way to do.


In my view, I pass a context object of the request to the email 
template. I need the request as i also want to put in the user's name.


in the email template now I changed it to :
http://{{request.get_get_host}}{% url "project.views.details" 
project.id <http://project.id> %}">{{ project }}


This seems to be working and quite simple too !

Regards,
Vibhu




On Fri, Nov 29, 2013 at 4:26 PM, Rafael E. Ferrero 
mailto:rafael.ferr...@gmail.com>> wrote:



https://docs.djangoproject.com/en/dev/ref/contrib/sites/#getting-the-current-domain-for-full-urls


2013/11/29 Vibhu Rishi mailto:vibhu.ri...@gmail.com>>

hi,

I have a setup where I have a project details page, and I can
do a "send email" which should send the email with the URL.

Email is working fine.

The problem is that i am getting a relative url in the tempalte

I have the following in the html email template :
http://project.id> %}">{{ project }}

This give me a URL in the email as /projects/1 ( 1 being the
project id)

How do i prepend the url of the server here ? e.g. I want this
to be http://localhost:8000/projects/1

Vibhu

-- 
Simplicity is the ultimate sophistication. - Leonardo da Vinci

Life is really simple, but we insist on making it complicated.
- Confucius
-- 
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
<mailto:django-users%2bunsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com
<mailto: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/CAPiONwn6cHwi51fJ63oFUOLof2QmFqsSeqz2VeOM_Jxk%2BaUYGQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.




-- 
Rafael E. Ferrero
-- 
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
<mailto:django-users%2bunsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto: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/CAJJc_8WWUyfwYd1cjxNzvm0xe5LjUTNDjPGDnYaaxE9w3B1C-g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.




--
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - 
Confucius

Re: Connecting to a MS SQL server from django

2014-01-19 Thread Fred Stluka

Larry,

+1 for Pycharm (JetBrains).

I use their DB tools to explore both MS SQL and MySQL DBs.  If
you like, I can dig up my notes on exactly how I made the
connection from PyCharm to MS SQL Server.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 1/15/14 11:51 AM, Avraham Serour wrote:

pycharm and jetbrains tools come with a db explorer

with a simple google search I found this [0] and [1] which have some 
references, you could also try [2] with wine


[0] http://stackoverflow.com/questions/399505/sql-server-gui-for-linux

[1] 
http://stackoverflow.com/questions/721852/developer-tools-to-directly-access-databases


[2] http://www.microsoft.com/en-us/download/details.aspx?id=8961

good luck


On Wed, Jan 15, 2014 at 6:42 PM, Adnan Sadzak <mailto:sad...@gmail.com>> wrote:


Maybe Your  MSSQL server is listening only on loopback interface.
Telnet from linux box to windows server on port 1433 and check if
port is open.
You can see also this few pages, just depends on Your server version.:

http://blogs.msdn.com/b/sqlblog/archive/2009/07/17/how-to-configure-sql-server-to-listen-on-different-ports-on-different-ip-addresses.aspx

http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx

Check also FreeTDS project: http://www.freetds.org/

Cheers,
Adnan


On Wed, Jan 15, 2014 at 5:19 PM, Larry Martell
mailto:larry.mart...@gmail.com>> wrote:

On Wed, Jan 15, 2014 at 12:09 AM, Avraham Serour
mailto:tovm...@gmail.com>> wrote:
> I would try using some kind of DB explorer first, to make
sure I have the
> ip, port and auth right, once you are able using some other
tool you can
> just use the same settings in your code

Do you know of any such beast for Linux?

> On Wed, Jan 15, 2014 at 6:46 AM, Larry Martell
mailto:larry.mart...@gmail.com>>
> wrote:
>>
>> On Tuesday, January 14, 2014, Mark Moss wrote:
>>>
>>> The default port for MySQL is 3306. Have you tried that one?
>>
>>
>>
>> I'm not trying to connect to MySQL - I'm trying to connect
to Microsoft
>> SQL server.
>>
>> --
>> 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
<mailto:django-users%2bunsubscr...@googlegroups.com>.
>> To post to this group, send email to
django-users@googlegroups.com
<mailto: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/CACwCsY5qidVz3PcCxnCfSpJx134hL68cicMaZUCmRKRpLJ6%3DWQ%40mail.gmail.com.
>>
>> For more options, visit
https://groups.google.com/groups/opt_out.
>
>
> --
> You received this message because you are subscribed to the
Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from
it, send an
> email to django-users+unsubscr...@googlegroups.com
<mailto:django-users%2bunsubscr...@googlegroups.com>.
> To post to this group, send email to
django-users@googlegroups.com
<mailto: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/CAFWa6tKSNGb6PLenqH3h9FHxMpp%3De%2Bv_W686Aq71HnjsGL-%2B%2Bw%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the
Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from
it, send an email to django-users+unsubscr...@googlegroups.com
<mailto:django-users%2bunsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.co

Re: Connecting to a MS SQL server from django

2014-01-19 Thread Fred Stluka

Larry,

We tried django-mssql and gave up.  Much better luck with
django-pyodbc.  We use the avidal version of it, along with pyodbc,
FreeTDS, and unixODBC.  Works perfectly.  If you like, I can dig up
my notes on exactly how we made the connection from Django to
MS SQL Server.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 1/14/14 6:15 PM, Larry Martell wrote:

I am trying to connect to a MS SQL server from django on Linux using
Vernon Cole's django-mssql package
(https://bitbucket.org/vernondcole/django-mssql-ado-merge/src).

When I first tried to connect it failed with:

Exception Type: DatabaseError at /report/CDSEM/EventsTable/
Exception Value: Cannot create connection
to=PYRO:ado.connect...@xx.xx.xx.xx:9099

I traced it through
/usr/lib/python2.6/site-packages/adodbapi/remote.py and I see it tries
to access os.environ['PROXY_PORT'], which is not defined and then it
defaults to 9099 - Is that the correct port or should I set
os.environ['PROXY_PORT']? How can I tell what port MS SQL db is
listening on? I googled this and it said the default MS SQL port is
1433. I set os.environ['PROXY_PORT'] to that and now I don't get that
error but it times out:


/usr/lib/python2.6/site-packages/Pyro4-4.22-py2.6.egg/Pyro4/core.py(160)__call__()

->  return self.__send(self.__name, args, kwargs)
(Pdb) n
TimeoutError: TimeoutE...imeout',)

I tried opening port 1433 with iptables, but still no joy.

I can connect to the MS SQL db locally from the host it's running so I
know it's up and my credentials are correct, and I can ping the
Windows box from the Linux host I am running on, so I know there is
connectivity to it from there.

Anyone here ever get this working? Anyone have any ideas as to what my
problem is or how I can debug this further?

Thanks!
-larry



--
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/52DBDAAD.7040202%40bristle.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Connecting to a MS SQL server from django

2014-01-19 Thread Fred Stluka
ocal/lib/libtdsodbc.so
Driver64= /usr/local/lib/libtdsodbc.so
UsageCount  = 2
CPTimeout   =
CPTimeToLive=
DisableGetFunctions =
DontDLCLose =
ExFetchMapping  =
Threading   =
FakeUnicode =
IconvEncoding   =
Trace   =
TraceFile   =
TraceLibrary=

Next, add this section to your `freetds.conf` file (see the section,
above, on installing FreeTDS, for the location on your operation system):

:::ini
[_your_odbc_dsn_name_]
host = _your_db_host_name_or_ip_
port = _your_db_port_number_
tds version = 7.0

## Create the requirements.txt file, containing:

Django==1.4.2
MySQL-python==1.2.4
pyodbc==3.0.7
-e 
git+https://github.com/avidal/django-pyodbc.git@a329ba8e7ea9dfcffce18139863c977b1218c09b#egg=sql_server.pyodbc-dev


## Install all the packages

$ pip install -r requirements.txt

### Mac OS X note

The `pyodbc` package that _pip_ installs uses iODBC by default. We want it
to use `unixODBC`, instead, for a couple reasons.

* First, there are numerous sites on the Internet that make claims such as
  "iODBC is a slightly less desirable ODBC manager than unixODBC"
  
(http://www.cerebralmastication.com/2013/01/installing-debugging-odbc-on-mac-os-x/).

  More people _seem_ to have better luck with `unixODBC`.
* Second, we're using `unixODBC` on Linux, and the configuration is already
  complicated enough. So, why not just use the same approach on both 
platforms?


To get `pyodbc` to use `unixODBC` on the mac, you have to build it from 
source,

and you have to hack the `setup.py`. Here's how to do it.

Create the pyodbc1.patch file containing:

*** setup.py.orig2013-12-19 21:49:10.0 -0500
--- setup.py2013-12-19 21:35:21.0 -0500
***
*** 145,151 

  elif sys.platform == 'darwin':
! # OS/X now ships with iODBC.
! settings['libraries'].append('iodbc')

  # Apple has decided they won't maintain the iODBC system 
in OS/X and has added deprecation warnings in 10.8.

  # For now target 10.7 to eliminate the warnings.
--- 145,151 

  elif sys.platform == 'darwin':
! # OS/X now ships with iODBC. We need unixodbc, however.
! settings['libraries'].append('odbc')

  # Apple has decided they won't maintain the iODBC system 
in OS/X and has added deprecation warnings in 10.8.

  # For now target 10.7 to eliminate the warnings.

Do these steps:

$ . ~/pythons/hhl/bin/activate
$ cd /tmp
$ git clone https://code.google.com/p/pyodbc
$ cd pyodbc
$ patch < pyodbc1.patch
$ pip uninstall pyodbc
$ python setup.py install

## Install the SQL Server ODBC backend

`pip install` does not completely install the SQL Server ODBC backend, so
there's one more manual step. You must manually copy some software within
your Python virtual environment.

$ cd ~/pythons/hhl/lib/python2.7/site-packages
$ cp -r ../../../src/sql-server.pyodbc/sql_server django/db/backends

## Set up your Django environment, by adding this to settings.py:

DATABASES = {
'cf': {
'ENGINE': 'django.db.backends.sql_server.pyodbc',
'NAME'  : '_your_db_name_',
'USER'  : '_your_db_username_',
'PASSWORD'  : '_your_db_password_',
# ODBC DSN defined in /etc/freetds.conf
'HOST'  : '_your_odbc_dsn_name_',
# Ignored for Windows; Required for Linux
'OPTIONS'   : {
# ODBC driver name in /etc/odbcinst.ini
'driver': 'FreeTDS',
},
},
}

## Verify that Python can get to the SQL Server database

At this point, you should be able to open a connection to the HHL test
SQL Server database as follows:

$ python
Python 2.7.5+ (default, Sep 19 2013, 13:48:49)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyodbc
>>> conn = pyodbc.connect('DRIVER=FreeTDS;'
  'SERVER=_your_db_host_name_or_ip_;'
  'PORT=_your_db_port_number_;'
  'DATABASE=_your_db_name_;'
  'UID=_your_db_username_;'
  'PWD=_your_db_password_')
>>> conn



## Initialize your database

$ python manage.py syncdb

## Fire it up!

$ python manage.py runserver

[Homebrew

Re: Problems Setting Up wsgi and Apache

2014-01-26 Thread Fred Stluka

Mark,

I'm doing this fine with Django 1.4.2 and Python 2.7.3.

My wsgi.py file looks like:


import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()



My Apache config looks like:



# WSGI setup, for use by Django and other Python webapps
# See notes in:
#  - http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
#  - http://code.google.com/p/modwsgi/wiki/ConfigurationIssues
#  - https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi
# --Fred 11/22/2012
WSGIPythonHome /var/python27/virtualenvs/hhl

Order allow,deny
Allow from all

WSGIDaemonProcess wsgi_apps processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup  wsgi_apps
WSGIScriptAlias   /mypythonapp "/var/www/wsgi-bin/mypythonapp.wsgi"
WSGISocketPrefix  run/wsgi

#
# hhlweb Django app
#

Order deny,allow
Allow from all

WSGIDaemonProcess hhlweb processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup  hhlweb
# Note: Support both aliases for backward compatibility with release 1.
WSGIScriptAlias /hhlweb /var/www/django/hhlweb/apache/django.wsgi
WSGIScriptAlias /   /var/www/django/hhlweb/apache/django.wsgi

# Map the Django STATIC_URL to the Django STATIC_ROOT

Order deny,allow
Allow from all

Alias /static/ /var/www/django/hhlweb/collected_static/

# Map the Django MEDIA_URL to the Django MEDIA_ROOT

Order deny,allow
Allow from all

Alias /media/ /var/www/django/hhlweb/media/



Hope this helps!
--Fred
--------
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 1/26/14 5:15 PM, Mark Phillips wrote:
I have my first django app running using runserver. I am now trying to 
get Apache to serve my site. I have read the django docs and quite a 
few other references on the Internet, but I cannot get Apache to do 
anything with my django site. And no error message.


I am running django 1.6 in a virtual environment with Python 2.7 on 
Debian Linux inside my LAN.


Configuration file for apache
/etc/apache2/sites-enabled/mom.conf:

ServerName beagle
ServerAlias beagle
ServerAdmin mark@beagle
DocumentRoot /var/www/mom

WSGIScriptAlias /mom 
/home/django/django_projects/inventory/inventory_project/wsgi.py



Order deny,allow
Allow from all


ErrorLog ${APACHE_LOG_DIR}/mom/error.log
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/mom/access.log combined


/home/django/django_projects/inventory/inventory_project/wsgi.py
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", 
"inventory_project.settings.dev")


from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

The project layout:
/home/django/django_projects/
└── inventory
├── fabfile2.py
├── fabfile.py
├── inventory
│   ├── admin.py
│   ├── admin.py~
│   ├── admin.pyc
│   ├── forms.py
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── migrations
│   ├── models.py
│   ├── models.py~
│   ├── models.pyc
│   ├── templates
│   ├── templatetags
│   ├── tests.py
│   ├── urls.py
│   ├── urls.py~
│   ├── urls.pyc
│   ├── views.py
│   ├── views.py~
│   └── views.pyc
├── inventory_project
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── media
│   ├── settings
│   ├── settings.py
│   ├── settings.py~
│   ├── settings.pyc
│   ├── settings.py.old
│   ├── static
│   ├── urls.py
│   ├── urls.py~
│   ├── urls.pyc
│   ├── wsgi.py
│   └── wsgi.pyc
├── manage.py
├── mom
├── Notes.txt
├── README
└── requirements.txt

/etc/apache2/mods-enabled/wsgi.conf
 WSGIPythonPath 
/home/django/django_projects/inventory:/home/django/.virtualenvs/inventory_project/lib/

python2.7/site-packages/

Any ideas on why I only get "Ooops cannot connect to beagle:7000/mom"?

Thanks,

Mark
--
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/CAEqej2O1ZfrsbywQWW9XSK5iEkybkMd4B%2B9Rxdi0bQC_Zzc%2BNA%40mail.gmail.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to djang

Re: Problems Setting Up wsgi and Apache

2014-01-27 Thread Fred Stluka

Mark,

Most likely your Apache server is running as user "apache" in
group "apache", and your Django code is being called by the
Apache server via WSGI, so it is also running as user "apache".

True?

If so, make sure that the files and directories needed by the
Apache and Django code are all accessible to user "apache".

P.S.  "or" vs "nor" -- Yeah, I have a VERY strong background in
English grammar.  Partly because it was beaten into me by
the nuns, and party because I'm such a fundamentally nerdy
engineer type that I found the technique of "diagramming a
sentence" to be fascinating and even fun.

So, I know the difference between an adjective and an adverb,
can cite things like the "present perfect tense", know what a
"dangling participle" is and that you are not supposed to end
a sentence with a preposition, etc.

But, the vast majority of people I meet seem to agree  with
Churchill that such rules are things "up with which we shall
not put" [1], so I rarely correct anyone any more, and have
come to recognize that language is a living evolving thing.
The most common usage is by definition the correct usage,
despite what it says in the Oxford English Dictionary (six
inches thick), "Warriner's English Grammar and Composition",
or the "MLA Handbook" -- all sitting within reach of me
right now).

[1] http://public.wsu.edu/~brians/errors/churchill.html

In fact, I pretty much avoid ever using "nor" or "whom"
because people notice when I do, and change their opinion
of me slightly away from hard-hitting, down-to-earth
engineer, and towards ivory tower academic.

Also, I decided many years ago to never use a full sentence
when a simple phrase will do.

Anyhow, good luck with your Django/WSGI setup!

Any more problems, speak up.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 1/27/14 11:01 AM, Mark Phillips wrote:

Fred,

Thanks for your help. I made some progress so far.

1. I discovered that I fogot to add the port 7000 to Apache´s ports.conf.

2. The Apache error logs were in /var/log/apache2/error.log and not in 
/var/log/apache2/mom/error.log. APACHE_LOG_DIR was not set.


2. Once I found the error logs, I found this -
[Sun Jan 26 06:25:04.325511 2014] [:warn] [pid 3472] mod_wsgi: 
Compiled for Python/2.7.5+.
[Sun Jan 26 06:25:04.325576 2014] [:warn] [pid 3472] mod_wsgi: Runtime 
using Python/2.7.6. <http://2.7.6.>


I tried removing mod-python as recommended by the django docs, but 
that did not help. So I removed the Debian package for python-wsgi and 
compiled python-wsgi myself.


I am not at the point where I get Forbidden - You don have permission 
to access /mom/inventory on this server. This is progress!! ;)


I guess the current problem is that I cannot run the django app from a 
user account (/home/django/). I added the user django to the group 
www-data, but I still get the forbidden message. I will try moving it 
to /var/www as you have it set up.


Thanks again!

Mark

P.S. I got a good chuckle from your signature block - "Open Source: 
Without walls and fences, we need no Windows or Gates." A small nit, 
but I believe it should read ..., we need no Windows nor Gates... to 
be grammatically correct.



On Sun, Jan 26, 2014 at 7:43 PM, Fred Stluka <mailto:f...@bristle.com>> wrote:


Mark,

I'm doing this fine with Django 1.4.2 and Python 2.7.3.

My wsgi.py file looks like:


import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()



My Apache config looks like:



# WSGI setup, for use by Django and other Python webapps
# See notes in:
#  - http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
#  - http://code.google.com/p/modwsgi/wiki/ConfigurationIssues
#  -
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi
# --Fred 11/22/2012
WSGIPythonHome /var/python27/virtualenvs/hhl

Order allow,deny
Allow from all

WSGIDaemonProcess wsgi_apps processes=2 threads=15
display-name=%{GROUP}
WSGIProcessGroup  wsgi_apps
WSGIScriptAlias   /mypythonapp "/var/www/wsgi-bin/mypythonapp.wsgi"
WSGISocketPrefix  run/wsgi

#
# hhlweb Django app
#


Order deny,allow
Allow from all

WSGIDaemonProcess hhlweb processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup  hhlweb
# Note: Support both aliases for backward compatibility with
release 1.
WSGIScriptAlias /hhlweb /var/www/django/hhlweb/apache/djan

Re: Python / Django Web Applications Developer - Michigan $90-$100/hr

2014-02-10 Thread Fred Stluka

Leigh,

If it helps, here's a list of questions you might want to answer in
your initial post of each position you are trying to fill:
- Brief description of the company, what it does, what the
   work environment is like, etc?
- Brief description of the responsibilities of the position you
   are trying to fill?
- Technologies used and skills needed?
- Consultant or FTE?
- Full time or part time?
- How long is the initial contract?
- How long is the project likely to run?
- Approx salary or hourly rate offered?
- Location, and is telecommute an option?

Cal, if Leigh posts only once for each position, and always
includes all of the above info, are you happy with that?  If not,
what additional info would you suggest?

I'm a programmer, not a recruiter, but I know a lot of people,
so I get asked often by friends to help them fill positions.  I
always insist on specific answers to all of the above before I
agree to do a mailing to any of my lists of hundreds of local
developers.  This has kept my subscribers happy.

HTH,
--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 2/10/14 3:41 PM, Cal Leeming [Simplicity Media Ltd] wrote:

Leigh,

As mentioned before, posting jobs is allowed (and welcomed!), but 
repetitive posts of the same job with little to no specification, 
isn't really suitable.


Can you please avoid this in future, otherwise the list will be abused 
by recruiters everywhere.


Thank you

Cal



On Mon, Feb 10, 2014 at 6:13 PM, Leigh Haugen <mailto:leighhau...@gmail.com>> wrote:


This contract opportunity is in Michigan (obviously not local),
but I was wondering if you might be open to posting it in the
Chicago Djangonauts Group. It is a great opportunity on a Cloud
Development team for somebody who is willing to take a temporary
job here in Michigan.

**

*Python / Django Web Applications Developer, Michigan 6+mth
contract, $90-$100/hr.*

*No phone calls. Please email resumes to: le...@kdmmcorp.com
<mailto:le...@kdmmcorp.com>*

REQUIREMENTS

Must have strong recent experience developing web applications
using *Python/Django*

ADDITIONAL SKILLS:

web development skills (Java, JavaScript, HTML and CSS)

great interest in user experience and usability

scaleable web development experience

*Leigh Haugen*

Managing Partner

KDMM Corp

-- 
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
<mailto:django-users%2bunsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto: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/003c01cf268b%24c5b273f0%2451175bd0%24%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKQagFT7%2BXXEtRctqqp-W4LO716HH8eyUGtpg_nDecGELr9oQ%40mail.gmail.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52F93E13.8000908%40bristle.com.
For more options, visit https://groups.google.com/groups/opt_out.


How to reverse both Django South migrations and source code?...

2014-04-18 Thread Fred Stluka

Django Users,

I'm having a problem reversing a Django South migration while also
reverting my source code to an an older version.  Any help?

Details:

My algorithm for doing a release is essentially:
1.  Update the source files
2.  % python manage.py migrate --all

This works great when moving forward.  Step 1 creates new migration
files.  Step 2 looks in the "south_migrationhistory" DB table to see
which migration files have not yet been run, and runs them.  Simple!

Not so great when moving backwards.  For example, when moving from
release 5 back to release 3.  Step 1 deletes the migration files for
releases 4 and 5, leaving only those for releases 1-3.  Step 2 looks
in the "south_migrationhistory" DB table, and decides to reverse
some of the migrations that have already been run, but the migration
files are already gone.  So it complains about GhostMigrations.

I have a few ideas about how to deal with this, but it must be a common
problem.  What do you folks do?

Thanks!
--Fred
----
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


--
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/5351AAE1.6010506%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it good idea to transition from MS Access to a webapp? And if so, is Django a good tool to do it?

2016-04-29 Thread Fred Stluka

  
  
Patrik,

Yes, Django can be used for that.  

The "ORM" features and the "templates" and "views" of Django 
make it very easy to do a "CRUD" app for a users to create/
retrieve/update/delete data in any RDBMS.  

There are some built-in security features like logins, protection 
against "CSRF" attacks, etc.  

Django "formsets" make it easy to show multiple rows with a 
details panel for the row currently selected.

With a web app, you won't have to re-distribute the front 
end.  Just push a new version to the server.

Django's templates and views both support "inheritance", 
which should solve your problem of managing multiple 
related forms.  And, there are many Open Source custom 
widgets for Django and for _javascript_ that will give you all
the sub-grouping and tree-views that you need.

Django scales very well to large amounts of data, large 
numbers of screens, and large numbers of users.  There 
are many performance tuning options, including "caching"
of templates, and of fully-constructed pages, and of DB 
data.  Also, lots of other "middleware" for security, 
performance, logging, and other "aspects" of the software.

Yes, you can run a Django server locally, behind a "firewall",
or can expose it to the world, securing various parts as 
needed.

To make it as secure as possible, I'd put in on a Linux server
that is protected by tools like Logwatch, Fail2ban, and 
Tripwire.  See:
- http://bristle.com/Tips/Unix.htm#unix_security
And be sure to redirect all page requests from HTTP to 
HTTPS.

I do all of this and more, including processing financial 
transactions and supporting "multitenancy", restricting 
access by thousands of different users, each to his own data, 
plus "attribute based access control" for cases where data is
shared, at the Web site I'm currently working on:
- http://HelpHOPELive.org

Sorry for all the terms and acronyms, but if you're considering 
writing such an app, you'll need to be aware of them and they're 
all pretty easy to Google.  Feel free to reply with more questions. 


Also, you'll quickly get a feel for Django's power if you go 
through the on-line tutorial at:
- https://docs.djangoproject.com/en/dev/intro/

Enjoy!
--Fred

  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  

On 4/29/16 12:57 PM, Patrik Mjartan
  wrote:


  Hi,


I work for a very small company that I developed an
  application for, all using MS Access (it has back-end MS
  Access db - although this is planned to change to some more
  robust RDBMS, and a front-end app built in MS Access).
  Currently this app is used to calculate the exact wages of
  some employees (sorry, English is not my native language so I
  don't know how that type of wage is called here, but basically
  we look at how many products they produced and calculate it
  based on that. It's not a hourly wage). However, this summer I
  would like to expand it to do some order management too (ie.
  each order has specific products that need to be produced...
  each of those can be produced by our employees and so it's
  directly linked to the wages).


However, it is very hard to manage everything using MS
  Access. Basically each time I make any change to FE or BE, I
  have to re-distribute the FE to all of the front-users. This
  is not a HUGE problem, the big problem, however, is within the
  MS Access itself, that is, it's very hard to manage all the
  forms as they are listed as simple names (ie. you cannot
  sub-group them efficiently to make a tree-view). Overall I
  cannot see myself working with MS Access in 5 years time as I
  can already see the scalability problems after a few months of
  working with it.


What I thought of, however, is making a website that is
  only for local use, but is it possible to have the same
  functionality as a regular front-end app? Is this good idea to
  begin with? I had a brief look at Django (I'm VERY new to
  web-dev, but I'm a fast learner I like to think) and I really
  like it so far. But is it possible to have the same level of

Re: Moving django app(nginx server) from iMac to Linux environment

2016-05-20 Thread Fred Stluka

  
  
Dhruv,

Should be no changes required.  I develop on Mac and just copy
my Django files (*.py, *.html, etc.) to my Linux server when 
I deploy.

You said you already have the same Django/gunicorn/nginx
  
  installed on both machines, right?  And you did a pip freeze 
  on one and a pip install -r on the other?
  
  Nothing left to do.
  

--Fred
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  

On 5/20/16 4:14 PM, Dhruv Jain wrote:


  
We have a basic Django(1.4.5)
application setup on a linux machine which runs via
gunicorn. 

  
We have another application which
is the main application which we plan to deploy on the linux
machine mentioned above, currently runs on an iMac
  Django/gunicorn/nginx server with Mysql. 

  
We have Django/gunicorn/nginx
installed on linux machine and have also installed all
dependencies which we got using pip freeze on the iMac. 

  
Now we basically need to transfer
the application currently hosted on the iMac to this linux
machine and make it run in the linux environment. 

  
Can anybody help me figure out
what all changes I need to make in the django code to make
it run on linux environment(mysql settings,etc?)

  
Thank you!
  
  -- 
  You received this message because you are subscribed to the Google
  Groups "Django users" group.
  To unsubscribe from this group and stop receiving emails from it,
  send an email to django-users+unsubscr...@googlegroups.com.
  To post to this group, send email to django-users@googlegroups.com.
  Visit this group at https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ab49ac8d-d173-4285-a5ed-5fc66b6fadee%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1e1be827-3ebc-a57f-e9b7-33a9c7a72bd2%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reportlab no module named pdfgen

2016-05-26 Thread Fred Stluka

  
  
David,

It works fine for me.  Must be something about your environment.

--Fred
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  

On 5/23/16 4:33 PM, david rodgers
  wrote:


  Hello All,


I am trying to use reportlab to generate pdfs from html.
  When I pip install reportlab it say its installed correctly.
  However, when I try 'from reportlab.pdfgen import canvas' I
  get an error saying no module named pdfgen. Any ideas to help
  solve this would be much appreciated.


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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/56450467-71c1-496c-9e48-a82d12660743%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/34045cf8-19eb-c19e-e58a-390bca1e4f09%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Recommended courses/materials for Python/Django course...

2016-06-15 Thread Fred Stluka

  
  
Python/Django users,

Any Python and/or Django courses/materials to recommend?

I may be teaching a Python/Django class soon.  My client may be 
willing to jumpstart by buying existing course materials (lecture 
slides, notes, homeworks, labs, reference links, any other
materials).
We'll certainly be happy to make use of any free materials.

Do you have any Python and/or Django courses/materials to 
recommend?

I've taken a quick look and found:
- Main web sites:
  - http://python.org
  - https://djangoproject.com (excellent docs and tutorial!)
- Free courses:
  - https://developers.google.com/edu/python
- Free/paid courses:
  - http://learnpythonthehardway.org/book
- Books
  - 2 Scoops of Django
- Paid courses:
  - Coursera
  - Codecademy
  - Khan Academy
  - Udacity
  - edX
  - Alison
  - Lynda
  - NewCircle.com

Any advice?  Thanks!
--Fred
  
      
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

  




-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/891ed395-21e8-80ac-8bf5-4598903cc748%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Recommended courses/materials for Python/Django course...

2016-06-17 Thread Fred Stluka

  
  
Ludovic,

Thanks for the tip!  I'll check them out.

--Fred
  
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 6/16/16 3:00 AM, ludovic coues
  wrote:


  The "Python Crash Course" aim to teach python from nothing in the
first half and to put that knowledge in application in the second half
through 3 projects. These are a 2D game, some data visualization
technique from diverse source and a django application.

Some people have some difficulty with the official django tutorial.
https://tutorial.djangogirls.org/en/ offer a really nice alternative,
more accessible to beginner and more complete too, with a section on
handling form in django for exemple.

I have also head of tango with django but I can't comment on this one.




  




-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e37767fb-deff-d347-b821-975b04c3541a%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Recommended courses/materials for Python/Django course...

2016-06-19 Thread Fred Stluka

  
  
Thanks for the feedback!

--Fred
  
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 6/17/16 10:04 AM, 06use...@gmail.com
  wrote:


  My 2 cents : 
I have started learning Python and Django from scratch 15 months
ago. I have bought 3 books which were VERY useful :
1) Two scoops of Django (Django 1.8) Daniel & Audrey Roy
GreenFeld : very good introduction to the Django world
2) Django by Example (Antonio Melé) : excellent implementation
of several real-world django projects (code can be dowloaded)
3) Beginning django CMS Nigel George : very good explanation of
how to use Django CMS
Cheers.
  
  -- 
  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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cd420c85-590b-4a87-aabb-954ec7189d10%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f3f1925d-8e96-e057-7342-0be244afc326%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Slow Django dev server reload

2016-07-03 Thread Fred Stluka

  
  
Krishna,

How long is "a long time"?  I have a project of ~200K lines of
python/django code.  The dev server reloads in a second or so.

--Fred 
   Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be
  of service! 
  Open Source: Without walls and fences, we need no Windows or
  Gates.
   

On 7/3/16 8:42 AM, Krishna Bharadwaj
  wrote:


  Hi everyone,


I am working on a project which is substantially big (~40k
  lines of python/django code including management commands).
  Dev server seems to be taking a lot of time to reload after
  making changes. I was wondering if this is due to any bad
  programming practice at my end? Or is this expected once the
  project grows big? I wanted to know if anyone in the group is
  dealing with it in a better way? 


- Regards
Krishna Bharadwaj
  
  -- 
  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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a97cacc1-c8c8-4075-a853-5f5d1bb156d6%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b613caa1-84d0-c778-3c49-ba8f0a178254%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Slow Django dev server reload

2016-07-04 Thread Fred Stluka

  
  
Hildeberto,

No, the number of migrations does affect how long it takes to
run automated tests, but should not affect how long it takes 
the dev server to start.

--Fred
  
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 7/4/16 3:46 AM, Hildeberto Mendonça
  wrote:


  Isn't it related to the amount of migration files
in your project?
  
On Mon, Jul 4, 2016 at 9:13 AM,
  Babatunde Akinyanmi <tundeba...@gmail.com> wrote:
  
This is a punch in the dark. It takes about 3
  -  5 seconds on my my windows machine when I run the dev
  server using pycharm's inbuilt terminal and my code is way
  below 5k lines

  
On Jul 4, 2016 7:20 AM,
  "Krishna Bharadwaj" <krishna.bm...@gmail.com>
  wrote:
  
Hi Fred,
  
  
  It takes about 3.5 - 5 seconds on my machine
(Mac OSX - 2.6 GHz Intel Core i5, 8 GB 1600 MHz
DDR3 and SSDs). I was curious to know if I was
doing something wrong. Any pointers regarding
this will be very helpful.

On Sunday, 3 July 2016 20:47:50 UTC+5:30, Fred
Stluka wrote:

  
Krishna,

How long is "a long time"?  I have a project
of ~200K lines of
python/django code.  The dev server reloads
in a second or so.

    --Fred 
   Fred Stluka -- mailt...@bristle.com
  -- http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com
  -- Glad to be of service! 
  Open Source: Without walls and fences, we
  need no Windows or Gates.
   

On 7/3/16 8:42 AM, Krishna Bharadwaj
  wrote:


  Hi everyone,


I am working on a project which is
  substantially big (~40k lines of
  python/django code including
  management commands). Dev server seems
  to be taking a lot of time to reload
  after making changes. I was wondering
  if this is due to any bad programming
  practice at my end? Or is this
  expected once the project grows big? I
  wanted to know if anyone in the group
  is dealing with it in a better way? 


- Regards
Krishna Bharadwaj
  
  -- 
  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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a97cacc1-c8c8-4075-a853-5f5d1bb156d6%40googlegroups.com.
  For more options, visit https://groups.google.com/d/optout.


  

  

-- 
You received this message because 

Re: Slow Django dev server reload

2016-07-04 Thread Fred Stluka

  
  
Krishna,

I'm using:
- Mac OSX 10.11.5 (El Capitan)
- 2.3GHz Intel Core i7
- 16 GB 1333 MHz DDR3
- 512GB SSD
- Python 2.7.3
- Django 1.4.2
- MySQL 5.1.33

And it takes less than a second from when I type:
    % python manage.py runserver
until I see:

Validating models...
  
  0 errors found
  Django version 1.4.2, using settings 'hhl.settings'
  Development server is running at http://127.0.0.1:8000/
  Quit the server with CONTROL-C.


I have about 40 models.py files, of which 25 are empty and 
exist only to prevent warnings when run automated tests.
The other 15 contain about 100 Django models with a total
of about 27,000 lines of code.

The 100 models all get validated against a locally running
MySQL server.

So, it should NOT be that slow on your Mac.

To narrow down the problem, I suggest you use the -v option:
    % python -v manage.py runserver
and watch to see what seems to be taking so long.

Any other suggestions, anyone?

--Fred
  
      
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 7/4/16 2:20 AM, Krishna Bharadwaj
  wrote:


  Hi Fred,


It takes about 3.5 - 5 seconds on my machine (Mac OSX - 2.6
  GHz Intel Core i5, 8 GB 1600 MHz DDR3 and SSDs). I was curious
  to know if I was doing something wrong. Any pointers regarding
  this will be very helpful.
  
  On Sunday, 3 July 2016 20:47:50 UTC+5:30, Fred Stluka wrote:
  
 Krishna,
  
  How long is "a long time"?  I have a project of ~200K
  lines of
  python/django code.  The dev server reloads in a second or
  so.
  
  --Fred 
     Fred Stluka -- mailt...@bristle.com
-- http://bristle.com/~fred/ 
Bristle Software, Inc -- http://bristle.com -- Glad to be of
service! 
Open Source: Without walls and fences, we need no
Windows or Gates.
 
  
  On 7/3/16 8:42 AM, Krishna Bharadwaj wrote:
  
  
Hi everyone,
  
  
  I am working on a project which is substantially
big (~40k lines of python/django code including
management commands). Dev server seems to be taking
a lot of time to reload after making changes. I was
wondering if this is due to any bad programming
practice at my end? Or is this expected once the
project grows big? I wanted to know if anyone in the
group is dealing with it in a better way? 
  
  
  - Regards
  Krishna Bharadwaj

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a97cacc1-c8c8-4075-a853-5f5d1bb156d6%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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d1e25f49-5672-4dd0-bdf1-cf8ffd012e4b%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 d

Re: How can i add my django project to Bitbucket ?

2016-07-05 Thread Fred Stluka

  
  
Deepak,

Bitbucket has pretty good documentation, including a Getting Started
section.  Should tell you all you need to know.  See:
- https://www.google.com/search?q=bitbucket+getting+started

--Fred
  
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 7/5/16 7:18 AM, Deepak Sharma wrote:


  I have created a simple django project and i have
created a simple app in it . Now i want to use Bitbucket for
code development since we are working in a team how could i
possibly do that ? 
  -- 
  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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2a4952bd-bf36-42d9-a479-68e95b623ae2%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4018e03a-c861-fde2-3ed0-60c34d01c55c%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: unindent does not match any outer indentation level

2016-07-05 Thread Fred Stluka

  
  
Deepak,

The error: "unindent does not match any outer indentation level"
means that you have a line of code that is less indented than the
immediately previous line, but is not lined up with any line before
that.  In your case, it's this line:

            def __unicode__(self):


which should be indented exactly as much as the line:

    def get_absolute_url(self):



--Fred
  
      
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 7/5/16 6:21 AM, deepak manupati
  wrote:


   
am getting unindentation error can any one fix my problem


File "/home/deepak/Desktop/ecommerce-2/src/products/models.py",
line 31
    def get_absolute_url(self):





from django.core.urlresolvers import reverse
from django.db import models
class ProductQuerySet(models.query.QuerySet):
      def active(self):
            return self.filter(active=True)
class ProductManager(models.Manager):
            def get_queryset(self):
                  return
ProductQuerySet(self.model,using=self._db)
            def all(self,*args,**kwargs):
                     return self.get_queryset().active()


class Product(models.Model):
            title = models.CharField(max_length=120)
            description = models.TextField(blank=True,
null=True)
            price = models.DecimalField(decimal_places=2,
max_digits=20)
            active = models.BooleanField(default=True)

            objects = ProductManager()
    def get_absolute_url(self):
                         return reverse("product_detail",
kwargs={"pk":self.pk})

            def __unicode__(self):
                        return self.title


  
  -- 
  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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fd982cf1-e022-4953-8764-34b78c511cbc%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dc47b91d-6e47-e554-5eff-90a4a88238b2%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Slow Django dev server reload

2016-07-05 Thread Fred Stluka

  
  
Krishna,

Only a third of your count -- 551

% tcsh 
  % python -v manage.py runserver >&! ~/1.1
  % grep -E "^import" ~/1.1 | wc -l
 551

So, you didn't see any noticeable pauses as the -v output was
streaming to the terminal window?  Sounds like it's just doing a 
lot of work, not stalling out anywhere in particular.

Why so many imports?  Seems odd that I have more models,
but fewer lines of code, and far fewer imports.  Are all of your
imports still needed?  Or are many of them obsolete and could
be deleted?  We tend to get rid of our dead ones pretty quickly
because PyCharm shows them as grey when they're not needed.

    --Fred
  
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 7/5/16 2:00 PM, Krishna Bharadwaj
  wrote:


  Hi Fred,


Thanks for providing your project as a reference and also
  the python verbose tip. I just started my dev server with the
  -v option to see how many import statements are fired. grep
  '^import ' returned about 1500 lines in the output (about 75
  models with about 40k lines of code). I could not narrow down
  the problem to any specific import / module. Curious to know
  how many imports were fired in your case?
  
  On Tuesday, 5 July 2016 01:50:26 UTC+5:30, Fred Stluka wrote:
  
 Krishna,
  
  I'm using:
  - Mac OSX 10.11.5 (El Capitan)
  - 2.3GHz Intel Core i7
  - 16 GB 1333 MHz DDR3
  - 512GB SSD
  - Python 2.7.3
  - Django 1.4.2
  - MySQL 5.1.33
  
  And it takes less than a second from when I type:
      % python manage.py runserver
  until I see:
  
  Validating models...

0 errors found
Django version 1.4.2, using settings 'hhl.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
  
  
  I have about 40 models.py files, of which 25 are empty and
  
  exist only to prevent warnings when run automated tests.
  The other 15 contain about 100 Django models with a total
  of about 27,000 lines of code.
  
  The 100 models all get validated against a locally running
  MySQL server.
  
  So, it should NOT be that slow on your Mac.
  
  To narrow down the problem, I suggest you use the -v
  option:
      % python -v manage.py runserver
  and watch to see what seems to be taking so long.
  
  Any other suggestions, anyone?
      
  --Fred 
 Fred Stluka -- mailt...@bristle.com
-- http://bristle.com/~fred/ 
Bristle Software, Inc -- http://bristle.com -- Glad to be of
service! 
Open Source: Without walls and fences, we need no
Windows or Gates.
 
  
  On 7/4/16 2:20 AM, Krishna Bharadwaj wrote:
  
  
Hi Fred,
  
  
  It takes about 3.5 - 5 seconds on my machine (Mac
OSX - 2.6 GHz Intel Core i5, 8 GB 1600 MHz DDR3 and
SSDs). I was curious to know if I was doing
something wrong. Any pointers regarding this will be
very helpful.

    On Sunday, 3 July 2016 20:47:50 UTC+5:30, Fred
Stluka wrote:

   Krishna,

How long is "a long time"?  I have a project of
~200K lines of
python/django code.  The dev server reloads in a
second or so.
    
    --Fred 
   Fred Stluka -- mailt...@bristle.com -- http://bristle.com/~fred/ 
  Bristle Software, Inc -- http://bristle.com -- Glad to be
  of service! 
  Open Source: Without walls and fences, we need
  no Windows or Gates.
   

Re: Email List

2016-07-18 Thread Fred Stluka

  
  
David,


There may be a package that does it all for you.  But if not, you
can
create a model that stores email addresses and send to those 
addresses via the Django mail package.  See docs at:
-

https://docs.djangoproject.com/en/dev/topics/email/

Here's what my code to send email looks like:


from django.core.mail import EmailMessage, EmailMultiAlternatives
def send(to, subject, body="", cc=[], bcc=[], html_body=None):
    try:
    # Pulls implicitly from settings.py, but can each be
overridden here.
    #   EMAIL_HOST
    #   EMAIL_PORT
    #   EMAIL_HOST_USER
    #   EMAIL_HOST_PASSWORD
    #   EMAIL_USE_TLS
    #   DEFAULT_FROM_EMAIL
    if html_body:
    email_message = EmailMultiAlternatives()
    else:
    email_message = EmailMessage()
    email_message.to = to
    email_message.cc = cc
    email_message.bcc = bcc
    email_message.subject = subject
    email_message.body=body
    if html_body:
    email_message.attach_alternative(html_body, "text/html")
    email_message.send(fail_silently=False)
    success = True

    except smtplib.SMTPServerDisconnected as e:
    msg = u'Unable to connect to SMTP server ' +
settings.EMAIL_HOST
    msg += u' to send e-mail to ' + unicode(email_message.to)
    exception = e

    except smtplib.SMTPSenderRefused as e:
    msg = u'The SMTP server ' + settings.EMAIL_HOST
    msg += u' refused to send e-mail from ' + unicode(e.sender)
    msg += u' when asked to send e-mail to ' +
unicode(email_message.to)
    exception = e

    except smtplib.SMTPRecipientsRefused as e:
    msg = u'The SMTP server ' + settings.EMAIL_HOST
    msg += u' refused to send e-mail to recipients ' +
unicode(e.recipients)
    msg += u' when asked to send e-mail to ' +
unicode(email_message.to)
    exception = e

    except smtplib.SMTPDataError as e:
    msg = u'The SMTP server ' + settings.EMAIL_HOST
    msg += u' refused to accept the message data'
    msg += u' when asked to send e-mail to ' +
unicode(email_message.to)
    exception = e

    except smtplib.SMTPConnectError as e:
    msg = u'Could not establish a connection with the'
    msg += u' SMTP server ' + settings.EMAIL_HOST
    msg += u' to send e-mail to ' + unicode(email_message.to)
    exception = e

    except smtplib.SMTPHeloError as e:
    msg = u'The SMTP server ' + settings.EMAIL_HOST
    msg += u' refused our HELO message'
    msg += u' when sending e-mail to ' +
unicode(email_message.to)
    exception = e

    except smtplib.SMTPAuthenticationError as e:
    msg = u'Unable to authenticate with SMTP server ' +
settings.EMAIL_HOST
    msg += u' when sending e-mail to ' +
unicode(email_message.to)
    exception = e

    except smtplib.SMTPResponseException as e:
    msg = u'The SMTP server ' + settings.EMAIL_HOST
    msg += u' returned: (' + unicode(e.smtp_code) + u') ' +
unicode(e.smtp_error)
    msg += u' when sending e-mail to ' +
unicode(email_message.to)
    exception = e

    except smtplib.SMTPException as e:
    msg = u'Unable to send e-mail to ' +
unicode(email_message.to)
    exception = e

    except BaseException as e:
    msg = u'An unexpected error occurred '
    msg += u' when sending e-mail to ' +
unicode(email_message.to)
    msg += u' during step: "' + progress + u'"'
    exception = e

    finally:
    if not success:
    raise EmailException(msg, exception)

--Fred
  
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 7/18/16 7:02 AM, 'davidt' via Django
  users wrote:


  I have a model that includes an option to subscibe
to an email list. However, being somewhat new to Django I am
assure how to create a bulk email list form this to send to the
appropriate people. I have read various 

Re: Is it possible to share a DB between Django and another application

2016-07-21 Thread Fred Stluka

  
  
Albert,

Yes, any other app , written in Python or any other language, should
be able to access your relational DB concurrently with your Django 
app, if it has the right credentials.  This is true for PostgreSQL,

MySQL, Oracle, DB2, or any other RDBMS you might use.

--Fred
  
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 7/20/16 11:03 AM, Albert180 wrote:


  Hello I wanted to know if it's possible to share a
Database between a Django App ( The WebApp) and another external
App which processes the Data ?
  -- 
  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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5b863fe3-c99f-44cf-b3fa-1773911a2223%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a0454491-752b-3daf-65cc-d9950ef45751%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Testing if a view have an html element with at least one attribute

2016-08-03 Thread Fred Stluka

  
  
Ludovic,

On my project, we have lots of test cases that do a GET or POST and

then check the returned HTML.  We use the BeautifulSoup HTML 
parser from our Django tests to avoid the types of errors you're 
getting with simple string comparisons.  I'm not sure if there any
pros/cons vs lxml, but it works great for us!

--Fred
  
      
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 7/31/16 5:08 PM, Andreas Kuhne
  wrote:


  Jupp, thats about what I meant :-)


Probably the best way, if you don't want to check text.


Regards,


Andréas

  
  2016-07-31 18:01 GMT+02:00 ludovic
coues <cou...@gmail.com>:
Currently,
  I am using lxml. More dependencies but it's the cleanest
  method I've found currently.
  I use it like that:
  
      from django.test import TestCase
      from lxml import etree
  
      class FormTest(TestCase):
          def test_input(self):
              response = self.client.get('/accounts/login')
              self.assertEqual(response.status_code, 200)
              doc = etree.HTML(response.content)
             
  self.assertEqual(len(doc.findall('.//input[@name="username"]')),
  1)
  

  
  
  2016-07-31 17:46 GMT+02:00 Andreas Kuhne <andreas.ku...@suitopia.com>:
  > 2016-07-31 15:59 GMT+02:00 ludovic coues <cou...@gmail.com>:
  >>
  >> Oh, sorry. A bit of misunderstanding and
  miscommunication on my part.
  >>
  >> The exemple I gave is just a quick way to
  reproduce my problem. The
  >> real test use self.client, reverse, cast
  response.content to a string.
  >> What I gave is a minimal exemple.
  >>
  >> Also, I assumed you talked about comparing
  bit of html element, not
  >> the raw content returned by the view. I'm
  quite uneasy to have the
  >> test failing if a class is added or removed
  from the element. But yes,
  >> your solution work for the current state of
  the application.
  >>
  >> 2016-07-31 14:46 GMT+02:00 Andreas Kuhne <andreas.ku...@suitopia.com>:
  >> > 2016-07-31 13:56 GMT+02:00 ludovic coues
  <cou...@gmail.com>:
  >> >>
  >> >> First, thanks for the suggestion.
  >> >>
  >> >> I just tried that, didn't work.
  >> >> Here is the test file I used:
  >> >>
  >> >>
  >> >>     from django.test import TestCase
  >> >>
  >> >>     class HTMLTestCase(TestCase):
  >> >>
  >> >>         def
  test_input_in_fieldset(self):
  >> >>             fieldset = """
  >> >>         
  >> >>             
  >> >>             
  >> >> maxlength="254" name="username"
  rows="3" type="text" required />
  >> >>         
  >> >>     """
  >> >>           
   self.assertInHTML('',
  fieldset)
  >> >>           
   self.assertInHTML('',
  fieldset)
  >> >>
  >> >>
  >> >> First input is to have a working
  exemple, second is taken as is from
  >> >> my view. Not closing the input in
  assertInHTML give an error `Coul

Re: Forcing Localization

2016-08-16 Thread Fred Stluka

  
  
Adam,

 Is it possible to force localization to a
  particular regional standard, no matter where I am viewing the
  page from?

I don't know for sure, but it seems like some of these settings
should be relevant.  It's a place to start anyhow.  Anyone have 
a more specific answer?

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating
systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same
as your
# system time zone.
TIME_ZONE = 'US/Eastern'

# Language code for this installation. All choices can be found
here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

# If you set this to False, Django will make some optimizations so
as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers
and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware
datetimes.
USE_TZ = True

INPUT_FORMATS = [
    '%Y-%m-%d',   # '2006-10-25'
    '%m/%d/%Y',   # '10/25/2006'
    '%m/%d/%y',   # '10/25/06'
    '%b %d %Y',   # 'Oct 25 2006'
    '%b %d, %Y',  # 'Oct 25, 2006'
    '%d %b %Y',   # '25 Oct 2006'
    '%d %b, %Y',  # '25 Oct, 2006'
    '%B %d %Y',   # 'October 25 2006'
    '%B %d, %Y',  # 'October 25, 2006'
    '%d %B %Y',   # '25 October 2006'
    '%d %B, %Y',  # '25 October, 2006'
]

--Fred


  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 8/7/16 9:48 PM, Adam Starrh wrote:


  
I am writing an application
  for my small business based in India, where numbers are
  commonly understood in terms of lakhs and crores.
ie. 1,000,000 is
  displayed as 10,00,000
I am assuming that enabling
  localization will cause numbers to display this way when I am
  viewing my application from an Indian server. However, I would
  also like to view the data this way when I am in the United
  States. Is it possible to force localization to a particular
  regional standard, no matter where I am viewing the page from?
  
  -- 
  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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/604036bf-2557-4c63-8718-3950dd89010f%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/52ffb9cd-000c-6e58-dc5e-a03341da2998%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Database data caching in Django?...

2016-08-17 Thread Fred Stluka

  
  
Django users,

Is there an easy way to enable an automatic write-through 
database cache in Django?

I'd want memcached or something to cache all data read by the 
Django ORM and use the cached copy on future reads, and of 
course update the cache as well as the DB (a "write-through" 
cache) when writing data.

Is there a piece of middleware I can activate to cause the ORM
to do this automatically for all DB queries?  Thanks!

Details:

I'm interested in caching the results of queries to the DB, not 
caching the results of templates or views.  So, it is different 
from the following, which I already know how to do:
- Caching of template files:
   -
http://us5.campaign-archive1.com/?u=a8d4be66d1927077a9255182d&id=a6f7d644a7&e=c90970e145
   -
https://docs.djangoproject.com/en/dev/ref/templates/api/#django.template.loaders.cached.Loader
- Caching of all Django views for an entire site:
   -
https://docs.djangoproject.com/en/dev/topics/cache/#the-per-site-cache
- Caching of specific Django views:
  -
https://docs.djangoproject.com/en/dev/topics/cache/#the-per-view-cache
- Caching of fragments of a Django Template:
  -
https://docs.djangoproject.com/en/dev/topics/cache/#template-fragment-caching

I'm also hoping to not have to add cache API calls throughout my
code, as described here:
-
https://docs.djangoproject.com/en/dev/topics/cache/#the-low-level-cache-api

I'd like the Django ORM to make the API calls for me automatically
when I call objects.get(), objects.filter(), save(), etc.  I'd hoped
to 
enable it simply by adding middleware or a custom manager or 
something.

Any suggestions?  I feel like I may be missing something obvious.

--Fred
  
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

  




-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/054667d7-381c-9783-a959-626d72574537%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to save one field value from a model to another field of a linked model.

2016-08-17 Thread Fred Stluka

  
  
Md. Ohiduzzaman,

Looks good so far.  What happens when you try it?

--Fred
  
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 8/16/16 1:34 PM, Md. Ohiduzzaman
  wrote:


  I have designed a linked model named Shiftdate as:

  class Shiftdate(models.Model):
shift_date = models.DateField(blank=False,unique=True)
sit_date = models.ForeignKey(Sitting,
on_delete=models.CASCADE)Using this model I changed sit_date to shift_date which is like: Sitting Date Shifting Date
2016-09-01   Sept. 15, 2016
2016-09-08   Sept. 19, 2016
Now I need to save this shifting date to the Sitting date as sit_date in Sitting model. My Sitting model is:class Sitting(models.Model):
sit_date = models.DateField(blank=False,unique=True)
cut_off_date = models.DateField(null=True, blank=True)
ballot_date = models.DateField(null=True, blank=True)
sess_no = models.ForeignKey(Session,
 on_delete=models.CASCADE)
genre = TreeForeignKey('Genre', null=True, blank=True, db_index=True)
I use def get_shift_date(self):return self.sit_date=self.shift_date 

  
  -- 
  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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8894d393-5d97-4c97-ba56-1a319d93acec%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c32af6d2-4ab6-73c5-8934-e08b4a3ff0a9%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to get tests to work

2016-08-17 Thread Fred Stluka

  
  
Matt,

Drop the "s" from "tests":

./manage.py test backups

--Fred
  
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 8/17/16 4:17 PM, Matt wrote:


  When I'm trying to get tests to work it simply
states that its unable to import .tests. I'm not sure
what I'm missing here. Here is some output please let me know if
you need more:


./manage.py tests backups
https://dpaste.de/4U9C



The test file:
https://dpaste.de/bBZt

  
  -- 
  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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/89d6fac7-0848-4e35-8b4a-62d24178c3aa%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d6df2c33-01fc-ae4f-d9f9-4fb6296f5342%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to get tests to work

2016-08-17 Thread Fred Stluka

  
  
Matt,

Oops!  Right.  I just noticed that in the dpaste.

My next guess is you may need to change the name

"good_index_text"
to something that starts with "test_" to get it to be recognized as
a 
test.

Or maybe something to do with "refreshes"?  The test trace shows
it trying to run testcase "refreshes.backups.tests", but in the
manual
import you did from the python shell, you only import
"backups.tests"

--Fred
  
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 8/17/16 4:27 PM, Matt wrote:


  Sorry for the typo, but I have already do that way.
I have the output in the the first link.

On Wednesday, August 17, 2016 at 2:24:19 PM UTC-6, Fred Stluka
wrote:

   Matt,

Drop the "s" from "tests":

./manage.py test backups

--Fred 
   Fred Stluka -- mailt...@bristle.com
  -- http://bristle.com/~fred/ 
  Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
  
  Open Source: Without walls and fences, we need no Windows
  or Gates.
   

On 8/17/16 4:17 PM, Matt wrote:


  When I'm trying to get tests to work it
simply states that its unable to import
.tests. I'm not sure what I'm missing here.
Here is some output please let me know if you need more:


./manage.py tests backups
https://dpaste.de/4U9C



The test file:
https://dpaste.de/bBZt

  
  -- 
  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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/89d6fac7-0848-4e35-8b4a-62d24178c3aa%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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/04fcacea-15d0-42af-afe5-424c2d1df86f%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fe478f0c-532e-8ad4-9b66-2a8145677f86%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to get tests to work

2016-08-19 Thread Fred Stluka

  
  
Matt,

At a glance, the directory structure looks OK.  Seems odd though
that you have some *.pyc files with no corresponding *.py file.
For example, frontend/tests.pyc and nas/tests.pyc.  Could such 
a file be tripping up the test runner?  That might explain why it 
fails when no arguments -- searching for all tests and getting 
confused -- but succeeds when told to run only backups.tests.

Same for all of the erp/*.pyc files.

Perhaps try deleting all *.pyc file in the entire tree and then run
the tests, letting them be recreated from the *.py files as needed.

Also, I see a backup/tests.py with no *.pyc file.  Is there a syntax

error in that file that makes it not compile?  Or is it just not 
getting that far?

Also, what is in pytest.ini?  Is it perhaps directing the test
runner 
to look for tests that don't exist?

--Fred


  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 8/18/16 3:49 PM, Matt wrote:


  Sorry replied to the wrong
thread: https://dpaste.de/OF8j

On Wednesday, August 17, 2016 at 11:16:27 PM UTC-6, Gergely
Polonkai wrote:

  Hello,
  this “refreshes.backups.tests” thing bothers me a
lot. Could you show us your directory structure, please?
  Best,
Gergely 
  
  
On Wed, Aug 17, 2016, 23:03 Matt <kicke...@gmail.com>
  wrote:


  Ok a step forward. When I spell out the
tests it works: 


https://dpaste.de/2MXf


But when I run test without arguments, it fails
  out:


https://dpaste.de/cgTH


There is more than the backups app here, but I plan
  to replicate out the fix when I get it.

  
  

  
On Wednesday, August 17, 2016 at 2:34:45 PM UTC-6,
    Fred Stluka wrote:

  
  

  

   Matt,

  

  

  
  

  

   Oops! 
Right.  I just noticed that in the dpaste.

My next guess is you may need to change the name
"good_index_text"
to something that starts with "test_" to get it
to be recognized as a 
test.

Or maybe something to do with "refreshes"?  The
test trace shows
it trying to run testcase
"refreshes.backups.tests", but in the manual
import you did from the python shell, you only
import "backups.tests"

  

  

  
  

  

  
--Fred 
  
  

  

  
  

  
    
  
 Fred Stluka -- mailt...@bristle.com -- http://bristle.com/~fred/ 
  Bristle Software, Inc -- http://bristle.com -- Glad to be
  of service! 
  Open Source: Without walls and fences, we need
  no Windows or Gates.
   

  

  

  
  

  

  
On 8/17/16 4:27 PM, Matt wrote:

  

  

  
  

  

  

Re: Help with django form an ajax, error 500

2016-08-21 Thread Fred Stluka

  
  
Elros Romeo,

Can you see the log file?  It may show details of the 500 error,
which will likely be some error reported by your Django code.
Could be anything from a Python syntax error to a failed attempt
to connect to a DB, to a misconfigured settings file, or anything 
else.

--Fred
  
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  
  

On 8/17/16 9:31 PM, agapito treviño
  wrote:


  Elros Romeo


as defined by the form.as_p.?
I want to implement this




  
  El viernes, 15 de julio de 2016, 18:49:00 (UTC-5), Elros Romeo
  escribió:
  
Hi, i hope you can help me, im trying to make
  a django post form without reloading the page using ajax,
  but im getting error 500 when submit, can you help me to
  fix this, this is my code:
  
  
  models.py
  

  
class ProductoConcepto(models.Model):
	producto =
  models.ForeignKey(Producto)
	orden =
  models.ForeignKey(Cobro)
	cantidad =
  models.FloatField()
  
  

  
  
  urls.py
  
  
  
from django.conf.urls import patterns, include, url
from django.contrib import admin
from cobro import views


urlpatterns = [
    url(r'^cobro/agregar_concepto/$',
  views.addconcept_product, name='add_concepto'),
]
  
  
  
  views.py
  
  
  


def addconcept_product(request):


    if request.method == 'POST':


        if form.is_valid():
            producto = request.POST['producto']
            orden = request.POST['orden']
            cantidad = request.POST['cantidad']


            ProductoConcepto.objects.create(producto=producto,
  orden=orden, cantidad=cantidad)


            return HttpResponse('')
  
  
  
  template
  
  
  
        
            
                
                    
                        
                            ×span>
                            Cerrar
                        
                        Agregar nuevo
  concepto
                    
                    
                        Datos de concepto
  a agregar:
                        
                        
                            {% csrf_token %}
                           
  {{form2.as_p}}









                            
                                
                            


                        

                    
                
            
        
  
  
  
  
</div>
<div>    $(document).on('submit', '#formulario-modal',
  function(e){</div>
<div>            e.preventDefault();</div>
<div>            $.ajax ({</div>
<div>                type: 'POST',</div>
<div>                url: '{% url 'add_concepto' %}',</div>
<div>                data: {</div>
<div>                    producto:

  1   2   >