Re: Questions on Django queryset iterator - wrt select_related and prefetch_related and how it works

2017-03-16 Thread Shawn Milochik
I think the benefit of using the iterator is best explained by an example:

Without iterator:

You loop through the queryset, using each item for  whatever you're doing.
As you do this, all the items are now in your local scope, using up RAM.
If, after the loop, you should want to loop through the data again, you
can. Upside: Can re-use the data. Downside: memory usage.

With iterator:

You loop through the queryset, using each item for  whatever you're doing.
As you do this, read items are garbage-collected. If you want to loop
through the data again, you'll have to hit the database again. Upside:
Memory usage.

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


Re: Will asgi become a PEP like wsgi is ?

2017-03-13 Thread Shawn Milochik
You don't have to subscribe. Just read it online.

https://groups.google.com/forum/m/#!forum/django-developers

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


Re: Uplaod execl file to populate django database

2017-03-13 Thread Shawn Milochik
1. Write code that puts data into your models. Do the Django tutorial if
you don't know how.

2. Write code that reads data out of your​ Excel file using the appropriate
library, easily found on pypi.

3. Use them together.

-- 
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/CAOzwKwGOVRONq9EN-cbb0Ln%2BLz1L9QbTS-ESqSmVqkgqa--G1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help: Data model in django

2017-03-09 Thread Shawn Milochik
Are you using PostgreSQL? Maybe you can use JSONField.

https://docs.djangoproject.com/en/1.10/ref/contrib/postgres/fields/#jsonfield

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


Re: Advice: count hits/pageview for high traffic website

2017-03-07 Thread Shawn Milochik
On Tue, Mar 7, 2017 at 6:38 PM, carlos  wrote:

> Hi,
> i try used django-hitcount but really not for website high traffic
> any advice for count visits/hits page for 60k or 100k  traffic for day
>
> thank any idea, link or whatever helps
>
>
My vote would be for something that uses Redis, or something written in Go.

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


Re: Django: how to send email when the publish date is reached for a blog item

2017-03-07 Thread Shawn Milochik
There are multiple ways to do it. For example:

Write a Django management command and call it from cron.

Use a scheduled Celery task.

-- 
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/CAOzwKwFCgHoF421%2B-qP%3DEjeiqxosv45YSYfw%3Dis00fH4BTxnYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: new to Django

2017-03-06 Thread Shawn Milochik
Go here:

https://code.djangoproject.com/

You'll find instructions on how to contribute, and also the bug tracker,
where you can search for easy bugs to fix.

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


Re: stop backgroundworker

2017-03-06 Thread Shawn Milochik
You'll have to send something from the browser (submit a form, AXAX, or
websockets) to a Django view and update something somewhere -- in Redis or
your database, probably. Then have your infinite loop check that location
for an updated value. I recommend Redis for this purpose.

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


Re: How to keep track of online users?

2017-03-02 Thread Shawn Milochik
You actually can't, unless you're using JavaScript for something like
websockets or other polling. You can only track their last activity using
their session.

Specifically, if a user loads one of your pages, you know it. But then you
won't know whether they're still reading it hours later or they closed
their browser immediately unless you use JavaScript in some 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.
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/CAOzwKwFvnJaKjesPASaeyTk5cGG3_hXiNWCVNshRAu6MLz7JSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Djnago User login

2017-03-01 Thread Shawn Milochik
It takes a little fiddling, but you can log in a user however you want.

https://docs.djangoproject.com/en/1.10/topics/auth/default/#how-to-log-a-user-in

In short, you can call django.contrib.auth.login(request, user) and force a
login without any authentication if you really wanted to. Given that, you
can make your own auth backend (subclass the default one) that returns True
for certain usernames without checking the value of the password field.

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


Re: Issues saving hex format data to binaryfield

2017-02-22 Thread Shawn Milochik
Why not base64 encode it and just store it in a charfield? There doesn't
seem to be any compelling reason to store it in binary.

-- 
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/CAOzwKwG9WD2g4nvjpnbA1Y%2BuKxLmShz%3D3woTAKG%2B3VvQroWs0g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Implementing a basic search for my website

2017-02-20 Thread Shawn Milochik
If you want a pre-rolled solution, just use Django-haystack. It'll do
exactly what you want.

If you want to create your own to avoid the dependency on additional
libraries and backend (you'll need something like Elasticsearch), that's
easy also. Let me know if you do. I have some sample code lying around and
will dig it up and document it a bit if you're interested in implementing
it. You'll still need to have to store your own indexed data in some kind
of backend, but you can use whatever you like.

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


Re: How to integrate a python algorithm in a Django website

2017-02-15 Thread Shawn Milochik
It's not clear what aspect of this you are looking for help with. Can you
be more specific? Have you written any code? If so, what is not working the
way you expect it to?

If you want to schedule something to run regularly, you can use Celery or
make a Django management command that gets run by cron.

If you just don't know where to start in creating a Django application to
plug your algorithm into, go through the tutorial first:
https://docs.djangoproject.com/en/1.10/intro/tutorial01/

-- 
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/CAOzwKwEzWA5P7H5TLiEbXpx2HwWY2aDr%3DJV%2Bd4SF%3Dr7G6YAJKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: OpenFace Integration with Django

2017-02-15 Thread Shawn Milochik
It's probably some difference between environments. If you know your code
works (it runs locally) and you're running the same versions of all your
dependencies (Python, Django, Openface, etc.), then it doesn't *seem* too
likely to be a major bug. It *could* be a bug -- not checking for and
handling an exceptional condition. For example, what if your code processes
each file in a directory -- but that directory is empty? It'll "work"
perfectly, and return nothing.

Add some logging along the way -- see what files it sees, what directories
it's looking it, etc. If you're hitting any external resources (APIs,
databases, etc.) make sure that your credentials work from your server and
that the services are available.

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


Re: Check if all boolean values are the same (database)

2017-02-14 Thread Shawn Milochik
I'd go with form validation -- you shouldn't allow a Purchase to be added
to a transaction if a Purchase with a conflicting status is already in
there, nor should a Purchase be able to be modified if it's in a
transaction with another Purchase.

Then you never have to check whether a transaction is valid. The models
pasted don't give the complete picture of the relationship, but garbage in,
garbage out, so just don't allow them to exist in the first place.

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


Re: Formset questions: data vs. initial values

2015-10-07 Thread Shawn Milochik
You *can* use ModelForms for this. You don't need an active instance.

Iterate over the days in the month, and if you have an instance in your
database you instantiate a ModelForm where "instance=thing." If not, you
instantiate a ModelForm that has no instance, and you send as data ""
(empty string) for the entry and the proper date for the ref_date. You can
use the data kwarg when creating the ModelForm -- just as you'd send
"request.POST" into it.

When you receive the forms back in POST, you validate and save the forms.
Override the save() method of your ModelForm so that, if "entry" is blank
you don't save it. Incidentally, you should also check if it already exists
for that date and delete it in that case.

You can have multiple forms using "prefix," which could just be the date as
a string.

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


Re: Load a static file with a variable name

2015-10-06 Thread Shawn Milochik
 Try this:



You're embedding {{pet_name}} in a string. If this was a regular Python
statement, it would be like writing "Hello, {0}" and not having a format()
at the end.

-- 
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/CAOzwKwE5Cgd379M93%3DYb46_3-%2B0%3DFdYUigojycOgpi14OxAJ0g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: http://pastebin.com/RWt1mp7F

2015-09-27 Thread Shawn Milochik
Try running ./manage.py shell

You often get a better traceback. I don't see anything wrong with the
beginning of the file you posted. However, you do have dirname twice, so
one is just wasted.
On Sep 27, 2015 13:50, "Cai Gengyang"  wrote:

> http://pastebin.com/RWt1mp7F --- If anybody can find any error with this
> settings.py file, let me know !
>
> Looked through it and can't find any mistakes. The error message I got was
> that there is an error on or before line 45 (like a missing parentheses) ,
> but can't seem to spot anything wrong , really weird ...
>
> Thanks ...
>
> Gengyang
>
> --
> 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/4365c3a4-76d6-4dc2-8cbf-eeb6a7d34d31%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/CAOzwKwEaZixZJzrs1Vbk69jn97uO_dd7XrC6pk5ZC%3DUr9JcMdw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django deployment

2015-09-15 Thread Shawn Milochik
 It's very simple. Just follow these instructions:

http://milocast.com/flasknginx.html

Instead of the final line (gunicorn filename:appname -b 127.0.0.1:),
use this:

./manage.py run_gunicorn -b 127.0.0.1:

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


Re: Receive post_save signal from another project

2015-09-03 Thread Shawn Milochik
Yes, it works. Just try it. If you put a post_save handler in any app it is
called when any model is saved in any app.

-- 
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/CAOzwKwE5-YEd-R_0tEuioV1RKKTov%2BhCDExpXw05Nmq-VEaBsA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Moderator and publishing workflow implementation in Django

2015-08-28 Thread Shawn Milochik
One easy solution:

Add an "approved_by" field, which is a ForeignKey to User. Let it be null
by default. When it's approved, save the User who approved it.
Then, whenever you're doing an ORM query to grab all stories to display,
just filter on approved_by being not_null.

Alternatively, you can add a DateTime field for "approved_on" and set it
when it's approved, and have it null by default.

Even better would be both, so you'd know who approved it and when, but if
you want to go simple you can.

You probably didn't find a pre-built packaged solution to this because it's
so trivial. Anyone can implement this in minutes with basic Django
knowledge.

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


Re: Django Many-to-many Query: Publications with no Articles? Publications with some Articles?

2015-08-24 Thread Shawn Milochik
I couldn't find it in Django's documentation; just from StackOverflow and
another source (both found via Google).

I always used to do something like
Thing.objects.filter(other__id__isnull=True) to do that, but clearly this
is better.

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


Re: Django CMS or Wiki?

2015-08-24 Thread Shawn Milochik
On Mon, Aug 24, 2015 at 2:49 AM, guettli  wrote:

>
> Has someone an advice which django application could be used?
>
> Regards,
>   Thomas Güttler
>
>
Why does it have to be a Django application? Static site generators such as
Hugo and Pelican are very popular, especially for things like blogs. The
content is updated so infrequently that involving database transactions in
a page load is just wasteful.

https://gohugo.io/

http://blog.getpelican.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/CAOzwKwGrVzJA%3D%3DFouxTHiFG2He3ev52MSbwrswh%2BHKdeNU3sXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Many-to-many Query: Publications with no Articles? Publications with some Articles?

2015-08-21 Thread Shawn Milochik
No articles:
Publication.objects.filter(article_set=None)

Has articles:
Publication.objects.exclude(article_set=None)

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


Re: Security News?

2015-08-18 Thread Shawn Milochik
I've been using this source for over 10 years:
https://www.grc.com/securitynow.htm

Main page: https://twit.tv/shows/security-now

-- 
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/CAOzwKwFM8Lo_16S%3D6so7j%2BfFFMGSMvHhh7mR0ggMyuEUn-1DbQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


reload_module no longer works when using caches["default"] instead of cache

2015-08-10 Thread Shawn Milochik
TL;DR; How do you modify cache settings during testing? Specifically,
enable/disable (by making TIMEOUT zero or non-zero).

Full question:

I had some code that looked like this:

from django.core.cache import cache
data = cache.get(key, {})

etc.

Now it looks like this:

from django.core.cache import caches
data = caches["default"].get(key, {})

etc.

The problem is that I have tests that change the TIMEOUT cache setting and
then reload the
module, using *six.moves.reload_module*. After making the change, the
reload never works. The
timeout remains the same as it is in the settings.py file.

The reason for the change is that I've been asked to use another cache
(other than *default*) for the
caching for this section of the app. The Django docs say that "import
cache" is deprecated, and
the proper way to do it since 1.7 is to use caches. We're using Django 1.8.

The docs (
https://docs.djangoproject.com/en/1.8/topics/testing/tools/#overriding-settings)
say "We do not recommend altering the DATABASES

setting.
Altering the CACHES

setting
is possible," but offers no details.

Has anyone found a solution for this?

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


Re: problem in setting up gunicorn and django

2014-03-17 Thread Shawn Milochik
It's much easier to just add gunicorn to your installed apps, and then do
"./manage.py run_gunicorn" instead of "./manage.py runserver." It's pretty
much takes the same options, except you'll want to add "-b" before your IP
and port, like " -b 127.0.0.1:8000."

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


Re: Is there a good reason why Django querysets can't be intersected?

2014-03-16 Thread Shawn Milochik
I don't know anything about efficiency, but it works at least as far back
as Django 1.3. I'd assume that, with lazy evaluation, it's probably about
as efficient as anything in the ORM.

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


Re: Is there a good reason why Django querysets can't be intersected?

2014-03-16 Thread Shawn Milochik
It seems to work for me:

a = Client.objects.filter(name__istartswith='a')   b =
Client.objects.filter(name__iendswith='t')
print a.count()   print
b.count()


c = a & b print
c.count()

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


Re: [newbie] -- Regex-matching ("Tango with Django")

2014-03-14 Thread Shawn Milochik
You're meant to only have one include that redirects URLs beginning with
rango to the app's urls.py.

Then, the app's urls.py must not have /rango in the URLs. The idea is that
all URLs starting with "rango" get the "rango" stripped off and passed to
the rango app, which itself has / and /about.

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


Re: do I need to run syncdb when I change the default value in a field of a model?

2014-03-14 Thread Shawn Milochik
On Fri, Mar 14, 2014 at 7:19 PM, Jonathan Baker <
jonathandavidba...@gmail.com> wrote:

> Does that mean that the default="" functionality is implemented by the
> ORM, instead of in the database layer?
>
>
Perhaps I'm wrong -- I'm looking at my South migrations and they do pass
the defaults. I believe that, either way, if you only touch the database
through the ORM it'll be set properly. It probably depends on what database
you're using.

However, there's a bigger issue -- if you run syncdb a second time, it will
do nothing, so it doesn't matter either way. If you want to modify an
existing table you need to use South (or do it manually). Syncdb will not
touch existing tables -- it only adds new ones. Or you can wipe out your
whole database and then run syncdb, that would fix it if you don't care
about your data.

Shawn

-- 
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/CAOzwKwHmO%3D3T9BvRU6c1OL6G7HbR-At0pbn5-V47Nb-fLrs-kQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: do I need to run syncdb when I change the default value in a field of a model?

2014-03-14 Thread Shawn Milochik
No, no syncdb required. The default applies to newly-created instances, not
existing ones.

-- 
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/CAOzwKwH-5UNR7ajWb%2B-w%3DepQRSUooEk%3DA-gwAjAhE8vtUT%3DA_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can please someone explain this code from the docs?

2014-03-14 Thread Shawn Milochik
That's just the syntax for calling a method on the base class.

1. MultiEmailField is a subclass of forms.Field.
2. forms.Field has a method named validate.
3. MultiEmailField also has a method named validate, so it overrides the
one on forms.Field.

So, for MultiEmailField to call its parent's validate() method, it has to
use super. That's how the subclass can use the parent's code, and add some
of its own.

-- 
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/CAOzwKwGWsc5%2B1BdpZK%3DJCyu88a%3DLk9gZFQg7yLR-6A6n0_k5SA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ForeignKey Field does not exist?

2014-03-13 Thread Shawn Milochik
On Thu, Mar 13, 2014 at 7:27 PM, wasingej wrote:

>
> When I go to grab information about the list with 'l =
> OwnerEntry(name='wasingej')', intuition would tell me that 'l' would be a
> list of entries with the name 'wasingej'.  However, when I try to access
> the value of 'l.list' django gives me this:
>
>
You want: records = OwnerEntry.objects.filter(name='wasingej')

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


Re: Self referencing models initialization

2014-03-13 Thread Shawn Milochik
On Thu, Mar 13, 2014 at 1:07 PM, Santiago Palacio Gómez
wrote:

> Ok, just did that and it worked (had to delete and re-create the db).
> Thank you very much for your quick reply.
>
> One last question though, just for curiosity, is there no way to create
> such cyclic relationships? If so, how?
>

You can always make a relationship cyclical after the fact by just
populating the foreign key field. You just can't have it required, because
then you have a chick-and-egg problem. It's possible you could make it work
by deferring the commit using commit=False [1], but overall it's probably a
bad idea.

[1]
https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method

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


Re: Different URLCONF for different domains

2014-03-12 Thread Shawn Milochik
URLs will be processed in the order they appear in your urls.py file.

If one of your first entries in urls.py is an "include" that handles all
URLs that start with "/a/", then all those requests will be handled by the
URL patterns in the included URLs.py.

Then, all URLs that don't get "caught" by that pattern will be checked
against the rest of the patterns in your urls.py until it finds a match.

According to the docs[1], urls.py has no access to the domain in question,
so this is a bit of a workaround.

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


Re: A subprocess call fails, but only under Django

2014-03-11 Thread Shawn Milochik
On Tue, Mar 11, 2014 at 8:07 PM, Shawn Milochik <shawn.m...@gmail.com>wrote:

>
> I tried to circumvent the entire problem by adding an "if __name__ ==
> '__main__'" block to the script and having it take a command-line argument
> via argparse and print the desired output. Then I did a
> subprocess.check_output call on *that* instead of importing the module.
> This worked from "manage.py shell," but not within a view in Django -- the
> same OS error 12.
>
>
TL;DR;

It's working now, but I don't know why. Thanks for looking, nothing to see
here.


I'm bored, tell me all about it:

I just tried this again with runserver and gunicorn, and this workaround
was working in both cases. Then I tried again importing the module directly
and it continued to work. It's looking like there was some other problem
and perhaps the "Django connection" was a red herring. I really don't think
there's less load on this machine now compared to earlier in the day.

This is really puzzling, because was able to replicate the problem
*consistently* and *repeatedly* earlier in the day.

Thanks to Russ, Drew, and Nick for taking the time to listen to my woes and
try to help.

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


Re: A subprocess call fails, but only under Django

2014-03-11 Thread Shawn Milochik
Hi Russ, thanks for the reply.

What I mean by "under Django" is if I call it from within a view or with
"manage.py shell" I get the problem. On the system in question, "manage.py
shell" does in fact invoke iPython. However, invoking iPython manually
(without manage.py) works. Executing the script stand-alone works.

I tried to circumvent the entire problem by adding an "if __name__ ==
'__main__'" block to the script and having it take a command-line argument
via argparse and print the desired output. Then I did a
subprocess.check_output call on *that* instead of importing the module.
This worked from "manage.py shell," but not within a view in Django -- the
same OS error 12.

The error happens in a call to os.fork within the subprocess.call or
subprocess.check_output methods (I tried both). The traceback is here:
http://bpaste.net/show/NRYtgvzoqyOBawl6XoxY/

I'm going to have to keep poking at it, but I was really hoping someone had
encountered this before. I did see some cases via Google on forums and
StackOverflow where people reported the problem, but there were no answers
other than directly addressing the amount of memory required, but I'm
pretty sure this script isn't consuming much memory. Even when it's not
running ls, it's just doing a subprocess call to gpg to sign and encrypt a
file. It takes well under one second.

Thanks for looking at it.
Shawn

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


Re: A subprocess call fails, but only under Django

2014-03-11 Thread Shawn Milochik
On Tue, Mar 11, 2014 at 9:24 PM, Nick Santos  wrote:

> Hey Shawn,
>
> What does your web stack and environment look like? If it's failing during
> a fork with an out of memory, that makes me wonder if the host process for
> django is consuming a chunk of memory for some reason, and when it gets
> forked, it'll get replicated over (which supposedly would fail, even with
> copy on write, with certain OS settings - I'm far from an expert in this
> area). Have you tested this code on another machine to see if it exhibits
> the same behavior?
> -Nick
>
>
Nick,

Thanks for the ideas. It was being run with gunicorn. I'll try with other
options, such as runserver and try to get it working on a separate machine.
The reason I've only been testing it on one server is that it's the one set
up with the gpg keychain our single-sign-on needs.

Shawn

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


Re: A subprocess call fails, but only under Django

2014-03-11 Thread Shawn Milochik
On Tue, Mar 11, 2014 at 9:06 PM, Drew Ferguson wrote:

> Hi
>
> Could your problem be some SELINUX issue?
>
> Perhaps disable SELINUX temporarily and see if the problem persists.
>
>
How would selinux cause the problem to only happen under certain
conditions? I don't think it's running. Based on this page[1] it doesn't
appear that it is the default on Ubuntu, and sestatus doesn't appear to be
available on Ubuntu server or in the apt-get repository.

[1] https://wiki.ubuntu.com/SELinux

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


A subprocess call fails, but only under Django

2014-03-11 Thread Shawn Milochik
Hi everybody. I have a weird problem. I have a small script that does a 
subprocess call. It works. It works when run via iPython. It blows up when 
run in manage.py shell or under Django with OSError: [Errno 12] Cannot 
allocate memory. Does anyone have any idea on how to fix this?

It's not doing anything that uses much memory -- even if I just make a 
subprocess call to the "ls" command it happens -- but only under Django.

I've done a bunch of Google searches and checked with the IRC channel, but 
so far nothing.

Thanks,
Shawn


-- 
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/14f01cac-6418-4acc-acfd-894b354a0c3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Atomic test/set/get using django cache API?

2013-05-14 Thread Shawn Milochik
I love and recommend Redis.

If you can use a Redis key instead of Django's cache, you can call get() on
the key. If the result is not None, now you have it. If it is None, you
know it didn't exist, so you can set it.

I don't think it's possible to have it work the way you want with the
default cache -- there's no way to know that in between checking for it and
finding it empty and setting it some other process didn't just set it.

You may have noticed there's still a tiny race condition in the naive use
of Redis I described. That's easily handled using Redis's "watch" command.

See:

http://redis.io/commands/exec

-- 
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: help regarding celery implementation with django

2013-05-14 Thread Shawn Milochik
I think your question boils down to "How do I use Redis from Python."

The answer is 'pip install redis' and play with it. Figure out which
commands you'll need by looking at them in the Redis docs. The docs are
good.

http://redis.io/commands

At the top of the page you can filter by type. I'd start with just the
"Strings" section, because it sounds like that's probably all you'll need.

-- 
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: Redirect specific username upon login to email change page

2013-05-13 Thread Shawn Milochik
Use a combination of the redirect() shortcut and request.user.

https://docs.djangoproject.com/en/1.5/topics/http/shortcuts/#redirect

-- 
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 with 2 subapps with same name

2013-05-10 Thread Shawn Milochik
It is not possible.

https://groups.google.com/forum/#!msg/django-users/AMYLfQo6Ba4/Y-57B0i7qy4J

-- 
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: middleware

2013-05-09 Thread Shawn Milochik
In your middleware you'll have access to the request object, so you can
easily check the URL, user, etc.

-- 
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: Some basic questions from somebody learning Django/Python

2013-05-07 Thread Shawn Milochik
Coincidentally, Russell just gave the answer to that question less than an
hour ago, so I'll just refer you to his reply:

https://groups.google.com/d/msg/django-users/AMYLfQo6Ba4/Y-57B0i7qy4J

-- 
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: Accessing django development server using internet

2013-05-07 Thread Shawn Milochik
pip install gunicorn, then run python manage.py run_gunicorn instead of
runserver.

Ensure that the port you're running your app on is being handled properly
by your Web server app (nginx or Apache). This means that hits to your URL
hit the Web server and are being directed internally at your listening port.

-- 
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 html input error

2013-05-06 Thread Shawn Milochik
No, it's a bad solution because it only fixes *some* unicode errors, and
only on your single machine.

See this. In my opinion it's the easiest Python unicode explanation to
understand:
http://farmdev.com/talks/unicode/

-- 
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: Noobie questions about Django and Databases

2013-05-06 Thread Shawn Milochik
In that case, you'd just add a 'model number' field to your table.

In the Django ORM, each Model instance relates to a table. So you aren't
going to want to have more than one to write your code against.

Just read through these two pages and everything should make sense:

https://docs.djangoproject.com/en/1.5/topics/db/models/

https://docs.djangoproject.com/en/1.5/ref/models/querysets/

It may seem like a lot of reading at first, but unless you have at least a
vague memory of what's in these pages when you start writing code, you're
going to get badly stuck and probably not have a clue what the best search
terms will be to get you unstuck.

-- 
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: Postgres/psycopg2 setup error

2013-05-06 Thread Shawn Milochik
I see you posted the question on StackOverflow as well. A quick search
turned up the same problem there, with a solution that allegedly works:

http://stackoverflow.com/questions/14863723/psycopg2-import-error-due-to-failure-to-load-libraries

-- 
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: Some basic questions from somebody learning Django/Python

2013-05-06 Thread Shawn Milochik
Hi Christopher.

In general, you don't install a Django app -- you just run it with
./manage.py runserver. If it's a "pluggable app" it should have an
installer. If it needs to be installed and the author hasn't provided an
easy way for you to do it, it's probably better to learn from code written
by someone else. People who fail to follow community standards and
best-practices probably don't write code you should be emulating.

The best way to learn Django (and probably anything) is to just do it. Come
up with a project you'd like to create. Then do it. When you get stuck, use
the Django docs, Google, and this list -- in that order.

If you come to the list and say "I did X and expected Y but Z happened,"
it's nearly guaranteed you'll get help. What will get you less help is to
come here and say "How do I make a clone of Facebook?" In other words, the
more convinced others are that you're actually trying and stuck the more
they'll be willing to give freely of their own time and experience to help
you.

It would be best and easiest (for you) if you were able to at least skim
any documentation you can get your hands on, because when you get stuck
you're very likely to know what search term to use in Google to solve your
problem. Unfortunately, that advice probably isn't practical -- there's too
much documentation to take in all at once. So just glance over the section
of the docs that pertains to whatever you're doing at the moment.

For example, if you're creating your first ModelForm, read (at least skim)
the whole section on ModelForms in the documentation. The same goes for the
Queryset API of the ORM. Even though you won't need most of it at the
moment, knowing what's there will prevent you from wasting a lot of time
and re-inventing a lot of wheels.

It's a great community. If you stick with it, it won't be long before
you're helping others yourself.

Shawn

-- 
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: a simple form confirmation before commit instance to database

2013-05-06 Thread Shawn Milochik
That feels like the wrong place to do it. The simplest thing would be to
just pop up a JavaScript dialog that intercepts the form POST, and ask then.

This does exactly what you want with the exception that it'll ask them
whether or not the form is valid, but I think that's irrelevant.

If you do it in JavaScript before submitting the form then your Python code
stays cleaner. Plus, if you did rig up some hideous hack that worked as
described in the original question, you'd suffer any time you tried to
write code that imported or used this form -- including unit tests.

-- 
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 - Query

2013-05-05 Thread Shawn Milochik
On Sun, May 5, 2013 at 3:29 PM, Hélio Miranda  wrote:

> How do I get the two?
>
> --
>
> Use .filter() instead of .get().

-- 
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: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Shawn Milochik
On Fri, May 3, 2013 at 10:22 AM, Marc  wrote:

Thanks. I understood and that doesn't work for my project as python/django
> can't handle the returned bytes I need to use.
> my project requires that the values are stored using the result of
> aes_encrypt from MySQL because other systems not made in python expect that
> and cannot be changed at this stage.
>
>
>
There's no Python package available that can handle the AES encryption and
decryption in a way that MySQL can understand?

-- 
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: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Shawn Milochik
On Fri, May 3, 2013 at 8:37 AM, Marc  wrote:

So Tom: i can't use those methods Shawn pointed out?  What I was hoping I
> can do is override the code that builds the SQL query.
> Further looking I think thats correct; as I did get a module working I
> found and played with which uses those methods and they don't seem to
> manipulate the query that is built by django, just the value passed.
>
> What isn't obvious in the Doc's Shawn is what is passed into and what is
> expected to be returned. The docs are not clear at all about that at all.
>
>
>
>
Sorry for the confusion. To be clear, I am suggesting that you make your
own Field subclass, instead of using, for example, a CharField or
TextField. The third link in that e-mail gave a working example of one. It
should be very easy. It doesn't change the SQL at all -- it converts
automatically between the plain text and encrypted value using those two
functions named in the docs.

-- 
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: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Shawn Milochik
On Fri, May 3, 2013 at 8:06 AM, Marc  wrote:

Thanks, i'll play with that and see what I can come up with.
> Docs are good, but sometimes really hard to read/find what you need :)
>
>
>
>
Oh come on, you mean "get_prep_value" and "to_python" weren't obvious? ;o)

-- 
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: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Shawn Milochik
https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#converting-database-values-to-python-objects
https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#converting-python-objects-to-query-values

Have a look at these two methods of a custom field. You can pretty easily
make your own.

You can use this as an example (see the EncryptedCharField class):

http://djangosnippets.org/snippets/2489/

-- 
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: Akiban + Django

2013-05-02 Thread Shawn Milochik
The short answer is that if you can use it in Python, you can use it in
Django.

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




Re: Need explanation of the flow of info between my javascript, my View, and my template, trying to diagnose my current roadblock.

2013-04-30 Thread Shawn Milochik
You're welcome. You may be new to it, but you ask better questions than
most I see. When I see "How do I do X?" I usually ignore it. When I see
"Here's what I did. It's not working for some reason" then I try to help if
I can. Keep up the good work.

Shawn

-- 
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: Need explanation of the flow of info between my javascript, my View, and my template, trying to diagnose my current roadblock.

2013-04-30 Thread Shawn Milochik
If I understand your question and your code properly, the problem is that
you are expecting a redirect, but what's happening is that the raw HTML
from the view is being returned to your JavaScript function, which does
nothing with it.

It seems like what you should do is just do a normal HTML form with an
"action" tag that just redirects to your view. Since you're not accepting
any return values in your JavaScript, you're not doing any "AJAX," so the
JavaScript is an unnecessary complication. If you cut out the JavaScript
entirely and make your button a normal "submit" button it will have the
desired behavior.

-- 
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: Little help needed writing models for star-ratings app

2013-04-29 Thread Shawn Milochik
I reiterate: Please read the ORM documentation. That will answer all of
your questions. Once you understand how to do queries in the ORM (and which
queries are easier than others) then you will know how to design your
models so that they'll be easy to work with. As you're reading, make notes
about how you can aggregate and search across tables/models.

-- 
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: Newbie: trying to get an existing project running on a different machine

2013-04-29 Thread Shawn Milochik
Do you have piston installed in the virtualenv where you're trying to test
this?

Check for any "local settings" on the production server that it may be
using but which aren't available through the repository.

-- 
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: Little help needed writing models for star-ratings app

2013-04-29 Thread Shawn Milochik
It looks like you're not looking for a "little help." You're looking for
someone to do the work for you.

You'll get the best help if you try something, get stuck, and explain what
you tried and what the error is.

Here is the documentation for using the ORM. This is not a snarky response
-- I really hope you do read it and learn how to use Django's ORM, which is
what you need to answer your own questions.

https://docs.djangoproject.com/en/1.5/ref/models/querysets/

Read that, try some stuff, then ask specific questions when you have
problems. You'll get a lot of great help if you 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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: quick problem with str and int

2013-04-29 Thread Shawn Milochik
How about adding a get_absolute_url method to your model? Then you can take
care of the logic there, instead of the template.

https://docs.djangoproject.com/en/1.5/ref/models/instances/#get-absolute-url

Worst-case, you can just do the conversion in your view and assign it as a
new property to your model. Since it's just a Python class instance, you
can do my_obj.temp_url = (whatever) and then your template can access
my_obj.temp_url.

-- 
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: Store arbitrary key-value pairs in model?

2013-04-29 Thread Shawn Milochik
A Django app sometimes benefits from a "No-SQL" database on the side. You
could do what you want using a text field and storing JSON or a pickled
value, but I advise against it. It's hard to query and de-duplicate.

-- 
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-filetransfers and HttpResponseRedirect

2013-04-29 Thread Shawn Milochik
Use HttpResponseRedirect, as you mention in your subject line.

-- 
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: Blog writen by django?

2013-04-27 Thread Shawn Milochik
Do a Google search. There are thousands.

-- 
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 admin error : coercing to Unicode: need string or buffer, NoneType found

2013-04-24 Thread Shawn Milochik
Ah, I missed that point. You could temporarily create an __init__ override
in your model and put the code there.

-- 
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 admin error : coercing to Unicode: need string or buffer, NoneType found

2013-04-24 Thread Shawn Milochik
See what I said above about iterating through the fields in your view. Use
logging, print statements, or dump output to a file.


On Wed, Apr 24, 2013 at 10:39 AM, Wissal Khadrouf WBC <
wissal.khadr...@wbc.ma> wrote:

> That's what I was thinking,it's from the data
> But I dont know wich field and how to find out
>
>
> 2013/4/24 Shawn Milochik <sh...@milochik.com>
>
>> Try iterating through your output in the view and look at field,
>> field.content, and if field.help_text. Somewhere you have a null value
>> which is None in Python.
>>
>> Since the traceback you posted (if it's complete) is all from Django's
>> code and not yours, then the error must be in your data.
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/r4VivI6pwOs/unsubscribe?hl=en
>> .
>> To unsubscribe from this group and all its topics, 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.
>>
>>
>>
>
>
>
> --
> Cordialement.
>
>
>  Wissal KHADROUF
> Web Development Engineer
> 81 Avenue Mers sultan, Grand Casablanca, Maroc
> 0660 347 547
> wissal.khadr...@wbc.ma
>
>
>  --
> 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.
>
>
>



-- 
e-mail: sh...@milochik.com
voicemail or fax: 206-350-8781
blog: http://milocast.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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django admin error : coercing to Unicode: need string or buffer, NoneType found

2013-04-24 Thread Shawn Milochik
Try iterating through your output in the view and look at field,
field.content, and if field.help_text. Somewhere you have a null value
which is None in Python.

Since the traceback you posted (if it's complete) is all from Django's code
and not yours, then the error must be in your 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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Upload csv file

2013-04-24 Thread Shawn Milochik
http://docs.python.org/2/library/csv.html#csv.DictReader

-- 
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: Upload csv file

2013-04-23 Thread Shawn Milochik
MongoDB documents are practically indistinguishable from Python
dictionaries.

You can use the csv module (csv.DictReader) to read in the CSV file and the
pymongo library to write those dicts to Mongo.

This really has nothing at all to do with Django.

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




Re: I have searched and searched for a CSV Importer that does the following.

2013-04-23 Thread Shawn Milochik
On Tue, Apr 23, 2013 at 10:37 AM, Derek  wrote:

>
> Yes, this is what I did; it is a significant amount of work to create such
> a facility and I would have been glad if someone had done this already!
>
> Of course, linking fields to column headers is the very simple part of it
> - you still need to load rows of data items; validate each-and-every item
> of data (including those which are - or may be or should be -  linked to
> fields in other tables); allow for data conversions decide what to do with
> duplicates; figure out error reporting (by field?  by row?  by sheet?);
> allow for re-uploads; and so on and so on.
>
> CSV Import is very slippery slope for your application - my advice is to
> avoid if at all possible!!
>
>
In my experience, CSV is wonderful, and any imports of any kind you do for
Django models should make use of a ModelForm 100% of the time.

CSV file -> csv.DictReader -> ModelForm -> is_valid() -> save()

For fields that are foreign keys you will obviously have to read through
the dictionaries created by DictReader and have simple functions that does
the lookup of the appropriate foreign keys, but that's no big deal.

Using a ModelForm makes sure your data is clean, and any validation you do
outside of that is either a completely wasted effort (duplicates ModelForm
clean()) or something that should be in your custom ModelForm subclass.

-- 
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: logging within celery processes

2013-04-20 Thread Shawn Milochik
I don't know the solution, but we had the same problem. We ended up dumping
Celery in favor of rq. It's much easier to work with and we were already
using Redis as a back-end.

If you do figure out the solution to this, please post it here. Also,
consider rq. We used Celery quite a bit and the changeover was fairly
simple.

For the record, the logging was not the main reason we dumped Celery.
Workers were also mysteriously locking up for some reason, and we couldn't
narrow it down to any of our tasks, nor even the async versus the
cron-style tasks. This is after running Celery for over two years on the
same server so it could be due to the evolution of our codebase rather than
Celery, but we wasted too many hours on it to want to deal with 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is it possible to create website like Squarespace or Wix in django?

2013-04-20 Thread Shawn Milochik
I don't think there's any kind of site you *can't* make with Django. It's a
Web framework, not a CMS.

It's definitely possible (and trivial) to offer a wide variety of
templates. It's also possible to allow a user to customize and save a
template, but that comes with a whole host of security risks you'll have to
consider.

The CSS is a slightly different matter, as Django is not in the business of
serving static content. However, if you're already customizing HTML
templates you can customize some CSS there. For that matter, you could
allow them to change the CSS link in the template to one of many choices
you provide, or to their own server/CDN. Again, that's probably a bad idea
for various security reasons, although technically possible.

-- 
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: How many workers do you run on one machine using django celery?

2013-04-20 Thread Shawn Milochik
In addition to Michael's good comments:

I suspect you won't have 100,000 tasks coming in every second of every day.
If you have to send out SMS messages and some of them take a few minutes to
go out, that should be fine for most purposes. In addition, some SMS
services have some limit per minute/hour for the number of messages you can
send. If so, you'll be forced to queue them regardless and trickle out the
sending.

-- 
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-newsletter, cron job not working

2013-04-18 Thread Shawn Milochik
Here's an example of something taken straight from my crontab from a
WebFaction account:

44 * * * * cd ~/webapps/awstats_milocast;./update_awstats.sh

This runs on minute 44 of every hour. There are five "time" parameters. The
first one is "minute." If you set a number there, it'll run on that minute
every hour.


On Thu, Apr 18, 2013 at 6:16 AM, Tom Evans  wrote:

> On Wed, Apr 17, 2013 at 7:38 PM, frocco  wrote:
> > Hello,
> >
> > Can someone give me an example of running a cronjob hourly?
> > I am on webfaction and cannot get this working.
> >
> > I tried
> >
> > @hourly /usr/local/bin/python2.7 ~/webapps/ntw/myproject/manage.py runjob
> > submit
> >
> > I get no email
> >
> > If I SSH in and sunit manually, it works fine
>
> Specify the full, absolute path to the file. Cron won't expand '~'.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Help interpreting profiler results (or: why is my app so slow?)

2013-04-18 Thread Shawn Milochik
Hit send too soon:

https://docs.djangoproject.com/en/dev/topics/cache/#template-fragment-caching


On Thu, Apr 18, 2013 at 8:39 AM, Shawn Milochik <sh...@milochik.com> wrote:

> Yes, it does look like template tags are taking some time. Is the page
> huge? Are you doing a ton of formatting? Is there something you could maybe
> move to server-side?
>
> Also, this might help with caching bits of your output:
>
>
> On Thu, Apr 18, 2013 at 6:17 AM, Matt Andrews <m...@mattandrews.info>wrote:
>
>>
>> On Thursday, 18 April 2013 10:45:40 UTC+1, Tom Evans wrote:
>>
>> On Wed, Apr 17, 2013 at 11:18 PM, Matt Andrews <ma...@mattandrews.info>
>>> wrote:
>>> > Hi all.
>>> >
>>> > Having performance problems with my Django app. I've posted here
>>> before
>>> > talking about this: one theory for my slowness woes was that I'm using
>>> raw
>>> > SQL for everything after getting sick of Django doing things weirdly
>>> > (duplicating queries, adding bizarre things like "LIMIT 3453453" to
>>> queries,
>>> > not being able to JOIN things like I wanted etc). I'm not opposed to
>>> going
>>> > back to the ORM but need to know if this is where my bottleneck is.
>>> >
>>> > I've run a profiler against my code and the results are here:
>>> > http://pastebin.com/raw.php?i=**HQf9bqGp<http://pastebin.com/raw.php?i=HQf9bqGp>
>>> >
>>> > On my local machine (a not very powerful laptop) I see Django Debug
>>> Toolbar
>>> > load times of ~1900ms for my site homepage. This includes 168ms of db
>>> calls
>>> > (11 queries, which I think are fairly well-tuned, indexed, etc). I
>>> cache
>>> > pretty well on production but load times are still slow -- some of
>>> this may
>>> > be down to my cheap webhost, though. In my settings I enabled
>>> > django.template.loaders.**cached.Loader but this doesn't seem to make
>>> much
>>> > difference.
>>> >
>>> > I'm having trouble seeing what the profiler results above are telling
>>> me:
>>> > can anyone shed any light?
>>>
>>> Most of your time is spent in pprint, which was called over 14,000
>>> times to generate your page. Over 2 seconds spent printing out debug.
>>> This should be telling you "don't use pprint when you want to see how
>>> fast your code is".
>>>
>>> Cheers
>>>
>>> Tom
>>>
>>
>> Good point Tom, apologies. Here's the profiler results with DebugToolbar
>> switched off (and ordered by cumulative time, thanks Shawn!):
>> http://pastebin.com/raw.php?i=y3iP0cLn
>>
>> The top one is obviously my "home" method inside my views, but I'm
>> struggling to get more from it than that. Lots of template rendering, but
>> caching not helping here...?
>>
>> --
>> 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.
>>
>>
>>
>
>

-- 
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: Help interpreting profiler results (or: why is my app so slow?)

2013-04-18 Thread Shawn Milochik
Yes, it does look like template tags are taking some time. Is the page
huge? Are you doing a ton of formatting? Is there something you could maybe
move to server-side?

Also, this might help with caching bits of your output:


On Thu, Apr 18, 2013 at 6:17 AM, Matt Andrews  wrote:

>
> On Thursday, 18 April 2013 10:45:40 UTC+1, Tom Evans wrote:
>
> On Wed, Apr 17, 2013 at 11:18 PM, Matt Andrews 
>> wrote:
>> > Hi all.
>> >
>> > Having performance problems with my Django app. I've posted here before
>> > talking about this: one theory for my slowness woes was that I'm using
>> raw
>> > SQL for everything after getting sick of Django doing things weirdly
>> > (duplicating queries, adding bizarre things like "LIMIT 3453453" to
>> queries,
>> > not being able to JOIN things like I wanted etc). I'm not opposed to
>> going
>> > back to the ORM but need to know if this is where my bottleneck is.
>> >
>> > I've run a profiler against my code and the results are here:
>> > http://pastebin.com/raw.php?i=**HQf9bqGp
>> >
>> > On my local machine (a not very powerful laptop) I see Django Debug
>> Toolbar
>> > load times of ~1900ms for my site homepage. This includes 168ms of db
>> calls
>> > (11 queries, which I think are fairly well-tuned, indexed, etc). I
>> cache
>> > pretty well on production but load times are still slow -- some of this
>> may
>> > be down to my cheap webhost, though. In my settings I enabled
>> > django.template.loaders.**cached.Loader but this doesn't seem to make
>> much
>> > difference.
>> >
>> > I'm having trouble seeing what the profiler results above are telling
>> me:
>> > can anyone shed any light?
>>
>> Most of your time is spent in pprint, which was called over 14,000
>> times to generate your page. Over 2 seconds spent printing out debug.
>> This should be telling you "don't use pprint when you want to see how
>> fast your code is".
>>
>> Cheers
>>
>> Tom
>>
>
> Good point Tom, apologies. Here's the profiler results with DebugToolbar
> switched off (and ordered by cumulative time, thanks Shawn!):
> http://pastebin.com/raw.php?i=y3iP0cLn
>
> The top one is obviously my "home" method inside my views, but I'm
> struggling to get more from it than that. Lots of template rendering, but
> caching not helping here...?
>
> --
> 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.
>
>
>

-- 
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: What is Model Manager?

2013-04-17 Thread Shawn Milochik
https://docs.djangoproject.com/en/1.5/topics/db/managers/

This should explain everything.


On Wed, Apr 17, 2013 at 8:10 PM, cha  wrote:

> Hello how are you
> I want to explain to me what is **"*Model Managers*"**  in django ??? and
> What are the useful ?
>
> --
> 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.
>
>
>

-- 
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: Help interpreting profiler results (or: why is my app so slow?)

2013-04-17 Thread Shawn Milochik
When you print those out with pstats, sort by cumtime.

cumtime = cumulative time

That will tell you almost exactly (and maybe really exactly) which code is
slow.

-- 
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-newsletter, cron job not working

2013-04-17 Thread Shawn Milochik
It's almost certainly an environment issue, such as an issue with your PATH
or PYTHONPATH.

Just add to the command so that it puts all standard output and standard
error to a file to read what the message is.

your_command &> /tmp/broken_cron.log

Then rig your cron job to run ASAP and read the log.


On Wed, Apr 17, 2013 at 2:38 PM, frocco  wrote:

> Hello,
>
> Can someone give me an example of running a cronjob hourly?
> I am on webfaction and cannot get this working.
>
> I tried
>
> @hourly /usr/local/bin/python2.7 ~/webapps/ntw/myproject/manage.py runjob
> submit
>
> I get no email
>
> If I SSH in and sunit manually, it works fine
>
> --
> 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.
>
>
>

-- 
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: VirtualEnv After the Fact

2013-04-13 Thread Shawn Milochik
You don't have to do anything differently than if you were starting
out fresh. A virtualenv is a self-contained thing.

Here's a recent blog post I wrote that might help:
http://milocast.com/virtualenv.html

You don't need to uninstall anything at all. However, you will need to
install them again, in your virtualenv.

-- 
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: New to testing

2013-04-10 Thread Shawn Milochik
Create a function with a name that *doesn't* start with "test" and you
can easily do what you want.

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




Re: Deploying: Desktop to server

2013-04-08 Thread Shawn Milochik
It should be fine, unless you're using encrypted fields, using the
SECRET_KEY setting as the key, and have a different key in production.

Of course, if you want to keep the databases in sync after that, that's
another issue.
On Apr 8, 2013 5:09 PM, "Tim Johnson"  wrote:

> FYI - I'm new to django, but have been doing web programming since
> '96 and python since '03.
>
> I intend to put together a test site on my desktop and push it to a
> remote server. I will be the only user making changes to this site.
>
> Thus I presume that it is OK to push the database as well.
>
> Am I correct?
>
> And URLs to discussion and instructions on deployment are invited.
> :)
>
> thanks
> --
> Tim
> tim at tee jay forty nine dot com or akwebsoft dot com
> http://www.akwebsoft.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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: djano user registration form and login(full example)

2013-04-06 Thread Shawn Milochik
I've seen some situations where it looked like signals are received
multiple times.

However, you can easily fix that by checking for the existence of the user
in your function, or a try/except that handles the integrity error.

Also, if you're starting a new project, consider upgrading to Django 1.5.
It's similar to 1.4
(which I assume you're using based on the documentation link you provided),
but also has customizable user models.

Although creating a profile model to be linked to the User model is still a
good idea, some fields make sense to have
in a custom User model:
https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#auth-custom-user

Shawn

-- 
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: djano user registration form and login(full example)

2013-04-01 Thread Shawn Milochik
Don't even worry about factories. They're for when you want a bunch of
forms for the same model on the page at once.

Use the UserCreationForm in django.contrib.auth.forms. It only accepts
a username and password, so you can either subclass it to add the
fields or make your own form and add it to your view so that they both
appear in the same HTML form. You can validate both and do what you
need to do.

You definitely shouldn't be writing validation logic for the password
and username and such -- that's what ModelForms are for.

If you have more specific questions just ask.

-- 
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: FileField delete and update handling

2013-03-30 Thread Shawn Milochik
You could remember the old path by saving it as a variable in your
model's __init__ function.

Something like this:

self._old_file_path = self.file_path

Then in your save():

#only if there was a non-blank path to begin with, and it changed
if self._old_file_path and ( self._old_file_path != self.file_path):

os.remove(self._old_file_path

I don't know if this is the best possible solution, but it would
guarantee that this would happen automatically from the admin and your
ModelForms without any extra code.

-- 
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: Doubt regarding JSON/SQL in Django

2013-03-30 Thread Shawn Milochik
On Sat, Mar 30, 2013 at 9:42 AM, Alexis Roda
 wrote:
> Yes, just import json and work with it, but be aware that you'll loose most
> of the functionality that makes django so productive: no ModelForms, no
> ORM/Querysets, no admin for tasks, ...
>

That's true. Without the ORM and Forms/ModelForms, you may as well
just use any one of the many tiny Python frameworks.

-- 
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: Doubt regarding JSON/SQL in Django

2013-03-30 Thread Shawn Milochik
Django is just Python, so yes. Just use the json module in the standard
library.
On Mar 30, 2013 9:23 AM, "Parin Porecha"  wrote:

> Hi,
>
> I have just started using Django. I want to create a to-do task
> manager application. Users would register, login and can work with
> their tasks. So, instead of creating a table in the database for each
> user, I want to create a JSON file for each user which will store all
> his tasks.
>
> Is there any way I can do this in Django ?
> I mean, use the database only for authentication, and use JSON to
> store data instead of storing it in the database.
>
> Thanks,
> Parin
>
> --
> 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.
>
>
>

-- 
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: Is there a plan for Django to handle NoSQL databases natively?

2013-03-27 Thread Shawn Milochik
Another point is one made by Alex Gaynor at PyCon 2012. Too often,
people ask "How do I do X in Django," when they should be asking "How
do I do X in Python," or "Does Django have something for X."

The first question is too limiting. Remember that Django is just some
Python code.

The second question expands your thinking. Is there any Python library
out there that does what I want? If not, should I write one?

The third question is good because it may prevent you from
re-inventing the wheel. If Django *does* have something that does what
you want, you may as well use it. But if not, you're far from stuck.

-- 
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: Avoiding Sessions

2013-03-27 Thread Shawn Milochik
Some clients may not allow cookies, which would be a problem if that's
your full session strategy. If you're storing nothing but the default
information in the cookie then there shouldn't be any risk, and in any
case the cookie is encrypted with the SECRET_KEY from your settings.
If you store additional information in the session then you run the
risk of exceeding the size allowed for a cookie, and theoretically
that information being exposed, although that's unlikely if your
SECRET_KEY is good.

In my opinion, using Redis as a back-end will be much better for
multiple reasons, not the least of which is performance. Also,
built-in key expiration in Redis is excellent (check your existing
session table for the entire history of sessions for your
application).

-- 
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: Navigation Bar

2013-03-27 Thread Shawn Milochik
If you put these links in your base template it will appear on every page.

If you wrap some of those links with template if/endif syntax and
check request.user to see if they have permission, you can hide
individual links, change their CSS classes, or replace them with a
something else.

-- 
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: Avoiding Sessions

2013-03-27 Thread Shawn Milochik
Use django-redis-sessions as a back end instead of the database.
On Mar 27, 2013 9:35 AM, "Venkatraman S"  wrote:

> So, if i am right, usage of sessions makes an extra call to the DB for
> every view with login_required.
>
> SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login",
> "auth_user"."is_superuser", "auth_user"."username",
> "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email",
> "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined"
> FROM "auth_user" WHERE "auth_user"."id" = 3
>
> ..app\debug_toolbar\utils\tracking/db.py in execute(118)
>   stacktrace = tidy_stacktrace(reversed(get_stack()))
>
> I do not want to be finicky about this 'extra' DB call, but was wondering
> if someone has used the cookie-based approach and has avoided sessions
> altogether. I just wanted to understand the implications on security and
> what i need to be aware of when using cookies in this way. Any experiences?
>
> -Venkat
> http://twitter.com/venkasub
>
> --
> 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.
>
>
>

-- 
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-users] Limit uploaded image properties

2013-03-25 Thread Shawn Milochik
It's easy to do it by file size in your server config. For example, in
nginx or Apache. You shouldn't have to set it in Django, and I don't
believe Django provides any ability to cap it.

https://docs.djangoproject.com/en/dev/topics/http/file-uploads/

-- 
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: What are the steps to build a website?

2013-03-25 Thread Shawn Milochik
On Mon, Mar 25, 2013 at 3:16 PM, Benjamin Marsili
 wrote:
> I am afraid to make mistakes ;). Since there is only one correct way to do
> things in Python, I don't want to hack my way around and waste my time after
> a few weeks.

When there's only "one correct way," it's for a tiny detail of
programming in Python.

There is no "one correct way" to create anything as large as an
application -- just some of its thousands of components.

-- 
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: Python path in new 1.4 project structure?

2013-03-25 Thread Shawn Milochik
On Mon, Mar 25, 2013 at 12:56 PM, Carsten Fuchs  wrote:
>> !!! PONTIFICATION ALERT !!!
>> Don't do that.
>
> Uhh, about the first word, I didn't find it in any dictionary.
> Is this somehow related to pope Franziskus?  ;-)
>

>From http://www.thefreedictionary.com/pontificate:
To express opinions or judgments in a dogmatic way.

He meant it as a humorous disclaimer.

-- 
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: What are the steps to build a website?

2013-03-25 Thread Shawn Milochik
On Mon, Mar 25, 2013 at 8:03 AM, Frankline  wrote:
> My advice: Stop making resolutions and just start something. You will be
> happier if you do. Along the way, you'll have gained an understanding of
> your project to so much more. That is how I learned.
>
> Do not be afraid to make mistakes along the way.
>

+1

You can't do it perfectly the first time. The only way to do it well
is experience. The only way to get experience is to make mistakes.

If you want to learn it, then jump in the pool head-first. If you have
a deadline by which it absolutely has to get done and work well, get
someone else to do 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: first steps with django

2013-03-24 Thread Shawn Milochik
On Sun, Mar 24, 2013 at 11:21 AM, Jeffrey Black  wrote:
> Give this a look first.
>
> http://www.jeffknupp.com/blog/2012/10/24/starting-a-django-14-project-the-right-way/
>
> jb

That's a good post. I give a hearty +1 to virtualenv, South, Fabric, and git.

-- 
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.




  1   2   3   4   5   6   7   8   9   10   >