Re: Help me choose OS for django server

2012-10-30 Thread Chris Pagnutti
Yeah.  Hosting the videos ourselves was one of the primary requirements for 
this project.

On Tuesday, October 30, 2012 3:50:30 PM UTC-4, Chris Pagnutti wrote:
>
> Hi.  I want to set up a production server for a django application.  
> constant.com offers Virtual Private Servers which should give me 
> virtually full control over the server, allowing me to install django and 
> all the stuff I need for my app to run properly.
>
> First, is this a good idea?  Do you think I can do this securely using the 
> django, apache, and lighttpd docs? or am I asking for trouble?  What are 
> the major security issues I need to be aware of when administering a server?
>
> Also, if I go this route, I'll need to choose an OS.  I'm running a 
> production server (just Apache + mod_wsgi) using my Arch Linux box, but I 
> don't think arch is the best idea.  I'm sorta trying to decide between 
> CentOS and Ubuntu.  Leaning toward CentOS, but just a little worried it 
> might be missing some of the packages I need.  I've never used CentOS 
> before.  Any advice?
>

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



Re: Help me choose OS for django server

2012-10-30 Thread Lachlan Musicman
On Wed, Oct 31, 2012 at 2:04 PM, Chris Pagnutti
 wrote:
>
> @Nik:
> Just following the django docs, it recommends Apache+mod_wsgi for the django
> app, and either lighttpd or nginx to serve media.  I liked the idea of
> serving media separately because the app is heavy on video streaming.  Is
> your suggestion to serve both the app and media using nginx?  Is this more
> secure?  Better performance?  Can you please point me to some docs that
> explain how to set up nginx for django?  Will google it in the meantime.

I presume there's a good reason for not using one of the video
streaming services out there (YouT, Vimeo, Blip, torrent into Miro via
rss feed)?

Note that I don't mean to suggest that you *don't* have a good reason
- but I've found that 9 times out of 10, there's no need to eat that
bandwidth cost yourself.

Cheers
L.

-- 
...we look at the present day through a rear-view mirror. This is
something Marshall McLuhan said back in the Sixties, when the world
was in the grip of authentic-seeming future narratives. He said, “We
look at the present through a rear-view mirror. We march backwards
into the future.”

http://www.warrenellis.com/?p=14314

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



Re: Help me choose OS for django server

2012-10-30 Thread Chris Pagnutti
Hi all.  Thanks to everyone for their comments.  If Debian is available, I 
think I like that idea for the OS.

As for server security, I think I had the basics, but there are some great 
points in your replies.  

@Nik:
Just following the django docs, it recommends Apache+mod_wsgi for the 
django app, and either lighttpd or nginx to serve media.  I liked the idea 
of serving media separately because the app is heavy on video streaming. 
 Is your suggestion to serve both the app and media using nginx?  Is this 
more secure?  Better performance?  Can you please point me to some docs 
that explain how to set up nginx for django?  Will google it in the 
meantime.

Thanks a whole bunch.

On Tuesday, October 30, 2012 3:50:30 PM UTC-4, Chris Pagnutti wrote:
>
> Hi.  I want to set up a production server for a django application.  
> constant.com offers Virtual Private Servers which should give me 
> virtually full control over the server, allowing me to install django and 
> all the stuff I need for my app to run properly.
>
> First, is this a good idea?  Do you think I can do this securely using the 
> django, apache, and lighttpd docs? or am I asking for trouble?  What are 
> the major security issues I need to be aware of when administering a server?
>
> Also, if I go this route, I'll need to choose an OS.  I'm running a 
> production server (just Apache + mod_wsgi) using my Arch Linux box, but I 
> don't think arch is the best idea.  I'm sorta trying to decide between 
> CentOS and Ubuntu.  Leaning toward CentOS, but just a little worried it 
> might be missing some of the packages I need.  I've never used CentOS 
> before.  Any advice?
>

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



Re: Help me choose OS for django server

2012-10-30 Thread Fred Stluka

Chris,

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

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

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

--Fred

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


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


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


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

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

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


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



Re: Help me choose OS for django server

2012-10-30 Thread John DeRosa
+2 for fail2ban.

I love reviewing fail2ban's email, and seeing the script kiddies continuing to 
try to login to root. Which is login-disabled on all our servers. Keep trying, 
kids...

John

On Oct 30, 2012, at 4:38 PM, Fred Stluka  wrote:

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


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



Re: Help me choose OS for django server

2012-10-30 Thread Fred Stluka

+1 for fail2ban

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

--Fred

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


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


I highly recommend fail2ban.

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

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


On Oct 30, 2012 4:08 PM, "Nikolas Stevenson-Molnar" 
> wrote:



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

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

_Nik

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

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

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


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



Re: Help me choose OS for django server

2012-10-30 Thread Trevor Joynson
I highly recommend fail2ban.

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

I've had a box with a 32 char random password get brute forced. Took three
years to do, but it happened.
On Oct 30, 2012 4:08 PM, "Nikolas Stevenson-Molnar" 
wrote:

>
> > First, is this a good idea?  Do you think I can do this securely using
> > the django, apache, and lighttpd docs? or am I asking for trouble?
> >  What are the major security issues I need to be aware of when
> > administering a server?
> This depends on your specific security requirements. If you're mainly
> concerned with protecting your server and website from unwanted
> tampering, then the important things are 1) only allow connections to
> ports you're using (HTTP) and restrict access via SSH to your IP or a
> local network; 2) make sure the software you're using is secure (the
> ones you mention are good; though I think Apache is vulnerable to a type
> of DDOS attack: http://en.wikipedia.org/wiki/Slowloris); 3) check your
> own code; Django is good about security but that doesn't mean you can't
> build an insecure application with it; 4) choose good passwords, etc.
> and if you're particularly concerned, consider using keys for your SSH
> connection.
>
> > Also, if I go this route, I'll need to choose an OS.  I'm running a
> > production server (just Apache + mod_wsgi) using my Arch Linux box,
> > but I don't think arch is the best idea.  I'm sorta trying to decide
> > between CentOS and Ubuntu.  Leaning toward CentOS, but just a little
> > worried it might be missing some of the packages I need.  I've never
> > used CentOS before.  Any advice?
> I've used both and haven't noticed much difference for the things I do.
> I would recommend nginx in place of lighttpd (better maintained), and if
> you're using either of those, Apache isn't necessary (though you will
> need a WSGI server, such as Gunicorn).
>
> _Nik
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Custom Admin Panel

2012-10-30 Thread Some Developer

On 30/10/2012 12:06, Bill Freeman wrote:

On Mon, Oct 29, 2012 at 12:13 PM, Some Developer
 wrote:

Hi,

I'm in the process of writing a Django site and one of the requirements is
that it have a custom admin panel and a custom control panel but I am having
some problems coming up with the best way to organise my application.

My initial idea was to have the admin (and control) panels as separate
applications with all the models that they require in specific apps. So for
instance if I have a news app then the admin panel simply loads the models
from the news app and displays them in the way that I want. This works fine
but it relies on a hard link between the admin panel and the news app. When
using the admin panel built into Django there is no hard link between apps,
you simply add an admin.py file to your application and the admin panel
takes care of the rest.

Is there some way to do this with a custom admin panel whilst still
retaining the flexibility of displaying the data associated with an app in a
much more complex manner than the built in admin panel allows?

I'm basically trying to decouple the two apps so that changes in one do not
have an adverse effect on the other one. Also it would be nice to use the
admin panel app in other projects that also require the flexibility of
having a custom admin panel.


You could mimic the way that the native admin does it:
admin.autodiscover() is called
by your top level urls.py at the first request.  It prances through the apps in
django.conf.settings.INSTALLED_APPS and tries to import admin (admin.py) from
each of them.  The admin.py modules register the desired models with the admin
interface.  You would need to implement your own equivalent of
admin.autodiscover()
(and the root urls.py is a good place to call it), and either modifiy
the admin.py files
to register with your admin, or, better, have your autodiscover look
for something
else, like myadmin, or name_of_project_admin.

But do realize that you can replace all of the templates that the
existing admin uses
just by putting your version in your top level templates directory
(see the tutorial).

You can even replace the admin views, by replacing the include of the
native admin's
urls by your own, and thus without monkey patching the admin.  This leaves you
free to take advantage of the native autodiscover (though that
registry of apps may
not be a public interface, and if not, not guaranteed to have a
painless upgrade path).
In this case you are free to use some of the native views and replace others, if
desired.

Bill


Thank you. Good advice.

I hadn't considered changing the included admin panel views. That may 
work depending on whether I can perform some of the more complex 
operations that I need.


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



Re: Help me choose OS for django server

2012-10-30 Thread Some Developer

On 30/10/2012 19:50, Chris Pagnutti wrote:
First, is this a good idea?  Do you think I can do this securely using 
the django, apache, and lighttpd docs? or am I asking for trouble? 
 What are the major security issues I need to be aware of when 
administering a server?


Configure a firewall to block all incoming ports except for port 80, 
443, and 22 (some suggest changing the port that SSH listens on but it 
has no real security value, a simple port scan by an attacker will 
reveal which port it is listening on so don't bother).


Disable root login via SSH.

Disable password logins via SSH.

Rate limit port 22.

Only allow one user (not root) access to the server via SSH.

Use SSH keys for authentication.

Make sure you always have the most recent security updates installed.

Make sure that the database server is not publically accessible (if you 
want to access your database server from your home computer connect to 
it via an SSH tunnel).


Just a few simple steps to take when securing a server.

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



Re: Joining querysets?

2012-10-30 Thread Lachlan Musicman
On Wed, Oct 31, 2012 at 1:26 AM, Bill Freeman  wrote:
>>>
>>> All the ref's I've read online are quite old and recommend using | or
>>> itertools.chain()
>>>
>>> Are these still the recommended method, or am I doing it wrong?
>
> This depends on what you mean by "join" (just in case you need it
> again in the future).  If you mean concatenate, you might try '+'.
>
> If you mean something fancier, you may find help in the Q and F
> queryset operations documentation.

I was looking for concat - so + works, great. Thanks for the tips.

L.

-- 
...we look at the present day through a rear-view mirror. This is
something Marshall McLuhan said back in the Sixties, when the world
was in the grip of authentic-seeming future narratives. He said, “We
look at the present through a rear-view mirror. We march backwards
into the future.”

http://www.warrenellis.com/?p=14314

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



Re: Help me choose OS for django server

2012-10-30 Thread Nikolas Stevenson-Molnar

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

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

_Nik

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



Help me choose OS for django server

2012-10-30 Thread Chris Pagnutti
Hi.  I want to set up a production server for a django application. 
 constant.com offers Virtual Private Servers which should give me virtually 
full control over the server, allowing me to install django and all the 
stuff I need for my app to run properly.

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

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

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



Re: django-ajax giving 403

2012-10-30 Thread Nicolas Emiliani
On Tue, Oct 30, 2012 at 1:03 PM, Chris Pagnutti wrote:

> Hi.  I'm trying to make some AJAX calls using django-ajax
> https://github.com/joestump/django-ajax
>
> But when I make the call, Chrome's console gives POST
> http://127.0.0.1:8000/ajax/my_app/my_ajax_view.json403
>  (FORBIDDEN)
> If I visit the url directly in my browser, I get {"data":{"message":"Invalid
> HTTP method used.","code":400},"success":false}
>
> Reading the docs, it seems likely that the problem may be with related to
> not explicitly passing the csrf token in my jquery .ajax() call. But the
> django-ajax docs/instructions don't mention anything about this, and I
> kinda figured the whole point of django-ajax is to simplify these matters.
>
> Anyone use django-ajax that can help? What do most django developers use
> for ajax? I've checked out Dajax, but I find it a bit much, yet I'm willing
> to give it, or some other package another try.
>

I used dajaxice  successfully (it is fearly simple) in a project that
updates a google map with markers every time you move the map. It worked
just fine. As Tom said my views also returned JSON. Regarding de CSRF token
you only need to include the CSRF tag at the view tamplate and that's
mainly it.

Check this example out :

http://www.dajaxproject.com/dajaxice/



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



-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

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



Re: ANN: Django REST framework 2 released.

2012-10-30 Thread Nikolas Stevenson-Molnar
+1

On 10/30/2012 9:55 AM, Mário Neto wrote:
> Amazing! Good work! :)
>
> 2012/10/30 Tom Christie  >
>
> Hi all,
>
> I'm incredibly pleased to announce the release of Django REST
> framework 2.
>
> REST framework 2 is a comprehensive reworking of the original project.
> Because this is a major re-design, rather than an incremental
> release, we've skipped 1.x entirely, and called this version 2.
>
> Some of the things it includes:
>
> * A completely redesigned, and really-rather-nice serialization
> API that mirrors Django's Forms/ModelForms 
> * Ties in cleanly and simply with Django's class-based-views.
> * Virtually every aspect of the design has been worked on - the
> end result is beautifully decoupled and simple. 
> * The (seriously awesome) browsable API gets a snazzy, fresh, new
> theme. 
> * The documentation has had a ton of love, is now built from
> markdown source and gets a custom bootstrap style.
>
> It has been an absolutely *huge* amount of work to get this over
> the line.
> I'm very proud indeed of the result, and I'd love it if you'd take
> a look.
>
> The full announcement & documentation is available here:
> http://django-rest-framework.org/topics/rest-framework-2-announcement.html
>
> Thank you to everyone who's contributed to the project and helped
> make this happen,
>
>   Tom
>
> NB. There's also a post on http://hackerne.ws/ if anyone fancies
> up-voting!
>
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/6Sm-297NsbgJ.
> To post to this group, send email to django-users@googlegroups.com
> .
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>
>
> -- 
> Att. *Mário Araújo Chaves Neto*
> /Programmer, Designer and U.I. Engineer/
> /*
> */
> /*MBA in Design Digital*/- 2008 - FIC
> /*Analysis and Systems Development*/ - 2011 - Estácio
> /*D*/*/esign and Implementation of Internet Environments/* - 2003 - FIC
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

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



Re: django-ajax giving 403

2012-10-30 Thread Tom Evans
On Tue, Oct 30, 2012 at 4:03 PM, Chris Pagnutti
 wrote:
> Hi.  I'm trying to make some AJAX calls using django-ajax
> https://github.com/joestump/django-ajax
>
> But when I make the call, Chrome's console gives POST
> http://127.0.0.1:8000/ajax/my_app/my_ajax_view.json 403 (FORBIDDEN)
> If I visit the url directly in my browser, I get {"data":{"message":"Invalid
> HTTP method used.","code":400},"success":false}
>
> Reading the docs, it seems likely that the problem may be with related to
> not explicitly passing the csrf token in my jquery .ajax() call. But the
> django-ajax docs/instructions don't mention anything about this, and I kinda
> figured the whole point of django-ajax is to simplify these matters.
>
> Anyone use django-ajax that can help? What do most django developers use for
> ajax? I've checked out Dajax, but I find it a bit much, yet I'm willing to
> give it, or some other package another try.
>

Mostly I write views that return JSON, and then call them from
javascript, usually using jQuery. That's enough automation for me.

Cheers

Tom

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



Re: How to implement clean() for a model with ManyToMany fields?

2012-10-30 Thread Carsten Fuchs

Hi Martin,

thank you very much for your very clear and prompt help!

:-)

Best regards,
Carsten



Am 29.10.2012 20:15, schrieb Martin J. Laubach:

Basically, you can't. M2m fields are saved after the model is saved, so
you either get objects that are not yet ready for that check (as you
experienced) or you will test the previous value of the m2m field,
neither of which is what you want.

You can modify the admin interface and do the validation in the
AdminForm, or perhaps catch the m2m_changed signal and do some checks
there, but you can't do the validation you want in the clean method.

 mjl



--
   Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
  Learn more at http://www.cafu.de

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



django-ajax giving 403

2012-10-30 Thread Chris Pagnutti
Hi.  I'm trying to make some AJAX calls using django-ajax 
https://github.com/joestump/django-ajax

But when I make the call, Chrome's console gives POST 
http://127.0.0.1:8000/ajax/my_app/my_ajax_view.json403
 (FORBIDDEN)
If I visit the url directly in my browser, I get {"data":{"message":"Invalid 
HTTP method used.","code":400},"success":false}

Reading the docs, it seems likely that the problem may be with related to 
not explicitly passing the csrf token in my jquery .ajax() call. But the 
django-ajax docs/instructions don't mention anything about this, and I 
kinda figured the whole point of django-ajax is to simplify these matters.

Anyone use django-ajax that can help? What do most django developers use 
for ajax? I've checked out Dajax, but I find it a bit much, yet I'm willing 
to give it, or some other package another try.

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



Re: Django free deployement help

2012-10-30 Thread Rahul Gaur
On Tue, Oct 30, 2012 at 8:16 PM, Alex Clark  wrote:

> **
>
> On 2012-10-30 13:33:31 +, Amr Abdel-wahab said:
>
>
> I have good experience with django developement but over local machines, I
> have never built a project so can someone recommend me a free service to
> deploy an experimental project on it along with easy tutorial to handle
> that.
>
>
> https://devcenter.heroku.com/articles/django
>
>
>
Checkout https://openshift.redhat.com/community/get-started/django


---
*Rahul Gaur*
*irc : iamaregee2*
*blogs : *aregee.wordpress.com ,  
http://sanencynicalwriter.wordpress.com/
*fb:* http://facebook.com/iamaregee
*github: *https://github.com/aregee

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



Re: ANN: Django REST framework 2 released.

2012-10-30 Thread Mário Neto
Amazing! Good work! :)

2012/10/30 Tom Christie 

> Hi all,
>
> I'm incredibly pleased to announce the release of Django REST framework 2.
>
> REST framework 2 is a comprehensive reworking of the original project.
> Because this is a major re-design, rather than an incremental release,
> we've skipped 1.x entirely, and called this version 2.
>
> Some of the things it includes:
>
> * A completely redesigned, and really-rather-nice serialization API that
> mirrors Django's Forms/ModelForms
> * Ties in cleanly and simply with Django's class-based-views.
> * Virtually every aspect of the design has been worked on - the end result
> is beautifully decoupled and simple.
> * The (seriously awesome) browsable API gets a snazzy, fresh, new theme.
> * The documentation has had a ton of love, is now built from markdown
> source and gets a custom bootstrap style.
>
> It has been an absolutely *huge* amount of work to get this over the line.
> I'm very proud indeed of the result, and I'd love it if you'd take a look.
>
> The full announcement & documentation is available here:
> http://django-rest-framework.org/topics/rest-framework-2-announcement.html
>
> Thank you to everyone who's contributed to the project and helped make
> this happen,
>
>   Tom
>
> NB. There's also a post on http://hackerne.ws/ if anyone fancies
> up-voting!
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/6Sm-297NsbgJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Att. *Mário Araújo Chaves Neto*
*Programmer, Designer and U.I. Engineer*
*
*
*MBA in Design Digital* - 2008 - FIC
*Analysis and Systems Development* - 2011 - Estácio
*D**esign and Implementation of Internet Environments* - 2003 - FIC

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



ANN: Django REST framework 2 released.

2012-10-30 Thread Tom Christie
Hi all,

I'm incredibly pleased to announce the release of Django REST framework 2.

REST framework 2 is a comprehensive reworking of the original project.
Because this is a major re-design, rather than an incremental release, 
we've skipped 1.x entirely, and called this version 2.

Some of the things it includes:

* A completely redesigned, and really-rather-nice serialization API that 
mirrors Django's Forms/ModelForms 
* Ties in cleanly and simply with Django's class-based-views.
* Virtually every aspect of the design has been worked on - the end result 
is beautifully decoupled and simple. 
* The (seriously awesome) browsable API gets a snazzy, fresh, new theme. 
* The documentation has had a ton of love, is now built from markdown 
source and gets a custom bootstrap style.

It has been an absolutely *huge* amount of work to get this over the line.
I'm very proud indeed of the result, and I'd love it if you'd take a look.

The full announcement & documentation is available here: 
http://django-rest-framework.org/topics/rest-framework-2-announcement.html

Thank you to everyone who's contributed to the project and helped make this 
happen,

  Tom

NB. There's also a post on http://hackerne.ws/ if anyone fancies up-voting!


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



Re: Easy way to make all form fields read only?

2012-10-30 Thread Matt Woodward
On Tuesday, October 30, 2012 5:20:44 AM UTC-7, ke1g wrote:

> Another protective hack would be to omit the 
> CSRF token when the form is read only. 
>

Thanks -- interesting idea! Ultimate goal is for the user to be able to 
tell they can't edit the form via the fields being read only (which applies 
a different style via the CSS) but that's a really interesting additional 
piece to potentially throw into the mix.

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



Re: Easy way to make all form fields read only?

2012-10-30 Thread Matt Woodward
On Tuesday, October 30, 2012 7:09:05 AM UTC-7, JirkaV wrote:

> On the UI side, you can set the "readonly" property on form fields. 
> This will prevent the field from being edited in a browser (I think so 
> - done that only once on a small internal project). 
>

Thanks -- I probably should have elaborated a bit more to say what I'm 
looking for (that may not exist) is a way of not having to do a user check 
on every single field and set the readonly flag individually, particularly 
since (at least based on my knowledge thus far) that gets messy given that 
we're using ModelForm and trying to render the fields with a simple 
template tag as much as possible. I haven't looked into whether or not that 
could be conditionally added as an attribute in the ModelForm, but that was 
another thought that crossed my mind.
 

>
> However, we warned - if *some* of your users can edit and submit the 
> form, you should also introduce server-side check testing if user is 
> allowed to edit fields. Making form fields read only won't prevent 
> anyone from actually submitting changed data (as it's just a 
> client-side control which can be easily worked around) 
>

Right, definitely will be doing this as well. Mostly the readonly state on 
the form is a visual/styling thing and also simply so there's no perception 
that people can edit things when they can't. Very good point to bring up 
though, and we'll definitely be checking again on the server side since as 
others have pointed out people can manipulate the DOM if they really want 
to wreak havoc. Thankfully this is an internal app which mitigates some of 
the danger, and certainly if this was a public app I would have fought a 
lot harder to not have a non-editable form be the way people view records.

Thanks!

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



Re: Easy way to make all form fields read only?

2012-10-30 Thread Matt Woodward
On Tuesday, October 30, 2012 1:36:19 AM UTC-7, elena wrote:

> How are you rendering the form? Are you using `forms.Form`?
>

We're using a ModelForm specifically.
 

>
> Do you mean "user's credentials" from `django.contrib.auth`?
>

Actually this is a custom user object -- users authenticate against Active 
Directory and we didn't yet look into tying that contrib.auth.user. 
Probably will do that on another phase of this app on Django 1.5 since 
that'll be a bit more flexible for our needs.

Thanks.

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



Re: Django free deployement help

2012-10-30 Thread Alex Clark

On 2012-10-30 13:33:31 +, Amr Abdel-wahab said:

I have good experience with django developement but over local 
machines, I have never built a project so can someone recommend me a 
free service to deploy an experimental project on it along with easy 
tutorial to handle that.


https://devcenter.heroku.com/articles/django




Many Thanks,
Amr Abdelwahab

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

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



--
Alex Clark · https://www.gittip.com/aclark4life/

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



Re: Django setup with elsatic beanstalk

2012-10-30 Thread Stefano Tranquillini
Well
i was able to play with it only right now.
there's a thing i can't understand. what's the application.py?
i've back this error 

2012-10-30 14:28:42,890 [INFO] (26110 MainThread) 
[directoryHooksExecutor.py-28] [root directoryHooksExecutor info] Output from 
script: 2012-10-30 14:28:42,875 ERRORThe specified WSGIPath of 
"application.py" was not found in the source bundle



and i don't have any application.py file in my folder .
this application.py i s specified in the .elasticbeanstalk/optionsettings

Il giorno mercoledì 24 ottobre 2012 14:06:52 UTC+2, Stefano Tranquillini ha 
scritto:
>
> thx.
> later i try both yr suggestions. i haven;t been notified of the previous 
> reply.
> thx
>
> On Wednesday, October 24, 2012 12:06:13 AM UTC+2, Andrzej Winnicki wrote:
>>
>> Try also to change settings in .elasticbeanstalk/optionsettings. 
>>
>>
>> [aws:elasticbeanstalk:application:environment]
>> DJANGO_SETTINGS_MODULE = 
>> PARAM1 = 
>> PARAM2 = 
>> PARAM4 = 
>> PARAM3 = 
>> PARAM5 = 
>>
>> [aws:elasticbeanstalk:container:python]
>> WSGIPath = application.py
>> NumProcesses = 1
>> StaticFiles = /static=
>> NumThreads = 15
>>
>> [aws:elasticbeanstalk:container:python:staticfiles]
>> /static = 
>>
>>
>> Then type eb update and trick should work.
>>
>>
>> On Friday, 12 October 2012 11:54:37 UTC+2, Stefano Tranquillini wrote:
>>>
>>> Mmm. seems that i missing something.
>>>
>>> this is the log
>>>
>>> 2012-10-12 09:36:51,352 [INFO] (24716 MainThread) 
>>> [directoryHooksExecutor.py-28] [root directoryHooksExecutor info] Output 
>>> from script: 2012-10-12 09:36:51,331* ERRORThe specified WSGIPath 
>>> of "application.py" was not found in the source bundle*
>>>
>>> 2012-10-12 09:36:51,353 [INFO] (24716 MainThread) 
>>> [directoryHooksExecutor.py-28] [root directoryHooksExecutor info] Script 
>>> succeeded.
>>> 2012-10-12 09:36:51,443 [INFO] (24641 MainThread) [command.py-126] [root 
>>> command execute] Command returned: (code: 0, stdout: , stderr: None)
>>> 2012-10-12 09:36:51,449 [INFO] (24641 MainThread) [command.py-118] [root 
>>> command execute] Executing command: Infra-EmbeddedPostBuild - 
>>> AWSEBAutoScalingGroup
>>> 2012-10-12 09:36:52,621 [INFO] (24641 MainThread) [command.py-126] [root 
>>> command execute] Command returned: (code: 1, stdout: Error occurred during 
>>> build: Command 01_syncdb failed
>>> , stderr: None)
>>> 2012-10-12 09:36:52,623 [DEBUG] (24641 MainThread) 
>>> [commandWrapper.py-60] [root commandWrapper main] Command result: 
>>> {'status': 'FAILURE', 'results': [{'status': 'SUCCESS', 'config_set': 
>>> u'Hook-PreAppDeploy', 'events': [*{'msg': 'Your WSGIPath refers to a 
>>> file that does not exist.', 'timestamp': 1350034611, 'severity': 'ERROR'}]
>>> *}, {'status': 'FAILURE', 'config_set': u'Infra-EmbeddedPostBuild', 
>>> 'returncode': 1, 'events': [], 'msg': 'Error occurred during build: Command 
>>> 01_syncdb failed\n'}], 'api_version': '1.0'}
>>>
>>> what's is this application.py (it's not mentioned in the tutorial) ? 
>>> idea about the WSGIPath?
>>>
>>> this is the directory tree:
>>>
>>> .
>>> |.ebextensions
>>> | |config
>>> |.elasticbeanstalk
>>> | |config
>>> | |optionsettings
>>>  |manage.py
>>> |mysites
>>> | |.DS_Store
>>> | |__init__.py
>>> | |__init__.pyc
>>> | |settings.py
>>> | |settings.pyc
>>> | |urls.py
>>> | |urls.pyc
>>> | |wsgi.py
>>> | |wsgi.pyc
>>> |requirements.txt
>>>
>>>
>>>
>>> two things. tutorial says that config file should be .config . it sounds 
>>> strange. 
>>> is it correct?
>>> where the requirements.txt should be located?
>>>
>>>
>>>
>>> On Thu, Oct 11, 2012 at 6:47 PM, Stefano Tranquillini <
>>> stefano.tr...@gmail.com> wrote:
>>>
 same problem, did you solve it?


 On Monday, October 8, 2012 7:22:51 PM UTC+2, shlomi oberman wrote:
>
> I'm trying without succes to setup a simple application using django 
> with elastic beanstalk from my windows machine.
> Does anyone have any expreience with this? I am currently getting the 
> following error from the EB console: 
> "Your WSGIPath refers to a file that does not exist."
>
>  -- 
 You received this message because you are subscribed to the Google 
 Groups "Django users" group.
 To view this discussion on the web visit 
 https://groups.google.com/d/msg/django-users/-/WiWZ2EApeWUJ.

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

>>>
>>>
>>>
>>> -- 
>>> Stefano
>>>  
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/6JaBPH_feDYJ.
To post to this group, send email to django-users@googlegroups.com.

Re: Easy way to make all form fields read only?

2012-10-30 Thread Jirka Vejrazka
On the UI side, you can set the "readonly" property on form fields.
This will prevent the field from being edited in a browser (I think so
- done that only once on a small internal project).

However, we warned - if *some* of your users can edit and submit the
form, you should also introduce server-side check testing if user is
allowed to edit fields. Making form fields read only won't prevent
anyone from actually submitting changed data (as it's just a
client-side control which can be easily worked around)

  HTH

Jirka

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



Django free deployement help

2012-10-30 Thread Amr Abdel-wahab
I have good experience with django developement but over local machines, I 
have never built a project so can someone recommend me a free service to 
deploy an experimental project on it along with easy tutorial to handle 
that.

Many Thanks,
Amr Abdelwahab

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



Re: Easy way to make all form fields read only?

2012-10-30 Thread elena
Hiya Matt,

As you already noticed yourself there are lots of different possible 
approaches to what you're talking about.

But it depends on where/how the form is getting to the page.

How are you rendering the form? Are you using `forms.Form`?

Do you mean "user's credentials" from `django.contrib.auth`?

Regards,
Elena


On Tuesday, October 30, 2012 11:04:55 AM UTC+11, Matt Woodward wrote:
>
> Semi-new to Django and working on my first "real" app, and I have a need 
> based on the user's credentials to display forms as either editable or 
> read-only. (Note this doesn't have anything to do with the Django admin in 
> case that has any bearing on the discussion.)
>
> Is there some fancy whiz-bang filter or middleware-type doo-dad (you can 
> tell I'm still learning all the terminology) that would easily make all 
> form fields read only?
>
> I thought about using javascript (this is an internal app so we can 
> mandate javascript be enabled) but before I went that route figured I'd ask 
> if anyone has had to do this and how they approached it.
>
> Personally I think it's weird to show someone a form they can't edit as 
> opposed to just dumping them to a static display page, but wasn't my call.
>
> Thanks!
>
> -- 
> Matthew Woodward
> ma...@mattwoodward.com 
> http://blog.mattwoodward.com
> identi.ca / Twitter: @mpwoodward
>
> Please do not send me proprietary file formats such as Word, PowerPoint, 
> etc. as attachments.
> http://www.gnu.org/philosophy/no-word-attachments.html
>  

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



Re: Scaling django (nginx + apache + mod_wsgi + postgresql)

2012-10-30 Thread Cal Leeming [Simplicity Media Ltd]
Just to chime in on this..

In terms of commercial options, we have sometimes gone with ZXTM (now known
as StingRay Traffic Manager) , it has some truly amazing features and you
should definitely check it out. I believe that RiverBed have since started
issuing free commercial licences for up to a certain traffic rate, and it's
a downloadable package/virtual appliance.

We also often use the load balancers that come with Rackspace Cloud, they
have proven to be quite efficient. When using this route, we also tend to
throw everything in front of CloudFlare too (if you haven't seen this
already, check it out. It is free for non SSL usage too!)

In a nut shell;

* ZXTM - commercial (free licence to a certain amount), amazing traffic
script language, self hosted
* Rackspace Cloud - does what it says on the tin, no traffic scripting
* F5 - commercial, not had any personal experience with it (but one of our
providers uses it as a shared load balancer for their customers and it's
been stable)
* haproxy - works, but it can be a pita!
* CloudFlare - this isn't a load balancer, but does give you much better
control over DNS (it proxies your site, and effectively makes 'DNS changes'
instant)

I believe uWSGI has some really good load balancing features too, but I
haven't used them in too much depth yet (despite being an avid user of
uWSGI for 2-3 years!)

Hope this helps

Cal

On Tue, Oct 30, 2012 at 8:14 AM, Kurtis Mullins wrote:

> The easiest thing I've found to use is simply uWSGI with Nginx. It's easy
> to just create new Django servers on the fly. You simply include the IPs in
> a list and it will use various algorithms (optional) to distribute the
> requests appropriately.
>
> As a lot of applications are IO bound, you could also use a distributed
> database system to help with your scalability. I don't have much experience
> in that area, though.
>
> This still leaves a point of failure: Nginx (or whatever load balancer or
> reverse proxy you use). Maybe someone else here will know more about load
> balancing Nginx itself ... that might require specialized hardware. I know
> a lot of cloud services offer load balancers (e.g. rackspace) so you could
> possibly use that with multiple nginx servers and further multiple django
> servers.
>
>
> On Tue, Oct 30, 2012 at 3:42 AM, Isaac XXX  wrote:
>
>> Hi there,
>>
>> maybe you're right, but I'm not really worried about RAM footprint, or
>> resources consumption. I'm concerned now on architecture, setting a right
>> scalable system, and a right cluster of systems, without lacks of
>> communications between them.
>>
>> Underlaying technologies can be easily replaced (say apache-mod_wsgi for
>> gunicorn or uwsgi), and some performance improvements can be made, but this
>> is not what I'm looking for. I'm looking for the tools to generate a robust
>> system, balancing requests through several systems, and allowing increase
>> the size of this system (adding more servers) without trouble.
>>
>> Cheers,
>>
>> Isaac
>>
>>
>> On 10/29/2012 05:18 PM, Some Developer wrote:
>>
>>> On 29/10/2012 16:03, Isaac XXX wrote:
>>>
 Hi there,

 thank you for response Tom.

 Actually, I've a complete idea at how to build this system, but I lack
 the exact information about how to join systems, and what I was looking for
 was a source of cohesive information on all systems. At least, when I
 finish to build that system, I will write this tutorial.

 For someone who can help me, I will describe here what I thought it can
 be this structure:

 - 1 nginx, as a reverse proxy on frontend, serving static/media and
 redirecting content to apache clusters
 - n apache servers, with mod_wsgi, serving dynamic data
 - m postgresql servers, in a master-slave flavour

 Cheers,

 Isaac

>>>
>>> Why not just ditch Apache entirely and just use Nginx for serving all
>>> media (both static and dynamic)? You can then save quite a few resources as
>>> you only need to run one HTTP server rather than two.
>>>
>>> Using Nginx to serve Django content works well. Just serve your Django
>>> application via FastCGI or uWSGI and you'll significantly simplify your
>>> configuration and reduce RAM usage on your servers as well.
>>>
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to django-users+unsubscribe@**
>> googlegroups.com .
>> For more options, visit this group at http://groups.google.com/**
>> group/django-users?hl=en
>> .
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To 

Re: Template Inheriting in Apache server

2012-10-30 Thread Bill Freeman
On Tue, Oct 30, 2012 at 1:37 AM, Pervez Mulla  wrote:
> Hi,
>
> Sorry for this question in this group .I Just wanted to know is there any
> way , I can Inherit different HTML templates from base.html as we do in
> Django framework in Apache2 server?
>
> Thank You
> Pervez

It's a different style, and less capable, but look for documentation
on server side
includes (SSI).   And it's not inheritance, but more like django's
include template
tag.

Bill

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



Re: Joining querysets?

2012-10-30 Thread Bill Freeman
On Mon, Oct 29, 2012 at 9:46 PM, Lachlan Musicman  wrote:
> On Tue, Oct 30, 2012 at 1:35 PM, Lachlan Musicman  wrote:
>> Hola,
>>
>> So I've reached the point where I feel it necessary to join querysets.
>
>
> Don't bother with this - I just wrote a better Query to solve this issue
>
>
> L.
>
>
>>
>> All the ref's I've read online are quite old and recommend using | or
>> itertools.chain()
>>
>> Are these still the recommended method, or am I doing it wrong?

This depends on what you mean by "join" (just in case you need it
again in the future).  If you mean concatenate, you might try '+'.

If you mean something fancier, you may find help in the Q and F
queryset operations documentation.

Bill

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



Re: Easy way to make all form fields read only?

2012-10-30 Thread Bill Freeman
On Mon, Oct 29, 2012 at 8:04 PM, Matthew Woodward  wrote:
> Semi-new to Django and working on my first "real" app, and I have a need
> based on the user's credentials to display forms as either editable or
> read-only. (Note this doesn't have anything to do with the Django admin in
> case that has any bearing on the discussion.)
>
> Is there some fancy whiz-bang filter or middleware-type doo-dad (you can
> tell I'm still learning all the terminology) that would easily make all form
> fields read only?
>
> I thought about using javascript (this is an internal app so we can mandate
> javascript be enabled) but before I went that route figured I'd ask if
> anyone has had to do this and how they approached it.
>
> Personally I think it's weird to show someone a form they can't edit as
> opposed to just dumping them to a static display page, but wasn't my call.
>
> Thanks!
>
> --

You *might* be able to do this with a class that you add to the form tag
when you're read only, and CSS rules for the various types of inputs that
make them disabled when used as a descendent of something with that
class.  You should still, of course, protect in the view against a disallowed
user submitting the form -- we all know that bad guys can use firebug to
modify the DOM, right?  Another protective hack would be to omit the
CSRF token when the form is read only.

Bill

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



Re: Custom Admin Panel

2012-10-30 Thread Bill Freeman
On Mon, Oct 29, 2012 at 12:13 PM, Some Developer
 wrote:
> Hi,
>
> I'm in the process of writing a Django site and one of the requirements is
> that it have a custom admin panel and a custom control panel but I am having
> some problems coming up with the best way to organise my application.
>
> My initial idea was to have the admin (and control) panels as separate
> applications with all the models that they require in specific apps. So for
> instance if I have a news app then the admin panel simply loads the models
> from the news app and displays them in the way that I want. This works fine
> but it relies on a hard link between the admin panel and the news app. When
> using the admin panel built into Django there is no hard link between apps,
> you simply add an admin.py file to your application and the admin panel
> takes care of the rest.
>
> Is there some way to do this with a custom admin panel whilst still
> retaining the flexibility of displaying the data associated with an app in a
> much more complex manner than the built in admin panel allows?
>
> I'm basically trying to decouple the two apps so that changes in one do not
> have an adverse effect on the other one. Also it would be nice to use the
> admin panel app in other projects that also require the flexibility of
> having a custom admin panel.


You could mimic the way that the native admin does it:
admin.autodiscover() is called
by your top level urls.py at the first request.  It prances through the apps in
django.conf.settings.INSTALLED_APPS and tries to import admin (admin.py) from
each of them.  The admin.py modules register the desired models with the admin
interface.  You would need to implement your own equivalent of
admin.autodiscover()
(and the root urls.py is a good place to call it), and either modifiy
the admin.py files
to register with your admin, or, better, have your autodiscover look
for something
else, like myadmin, or name_of_project_admin.

But do realize that you can replace all of the templates that the
existing admin uses
just by putting your version in your top level templates directory
(see the tutorial).

You can even replace the admin views, by replacing the include of the
native admin's
urls by your own, and thus without monkey patching the admin.  This leaves you
free to take advantage of the native autodiscover (though that
registry of apps may
not be a public interface, and if not, not guaranteed to have a
painless upgrade path).
In this case you are free to use some of the native views and replace others, if
desired.

Bill

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



Re: psycopg2.DataError

2012-10-30 Thread Tom Evans
On Tue, Oct 30, 2012 at 6:06 AM, jondbaker  wrote:
> When I run 'python manage.py validate' the following error is returned:
>
> psycopg2.DataError: invalid value for parameter "TimeZone": "UTC"
>
> settings.py
> TIME_ZONE = 'America/Denver'
> USE_TZ = True
>
> I'm using Django 1.4.2 with Postgres 9.1/PostGIS on OSX.
>
> To test, I went back and commented out my custom apps in INSTALLED_APPS, but
> the error is still there. If I set USE_TZ to False, then the error becomes:
> psycopg2.DataError: invalid value for parameter "TimeZone": "America/Denver"
>

Postgres uses your OS's zoneinfo information, which for some reason is
missing on your OS X install.

You would probably have more luck getting an explanation on the
postrgresql mailing lists. To reproduce without django, open a
database shell ("python manage.py dbshell" is an easy way) and type in
"SET TIME ZONE 'UTC';".

Cheers

Tom

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



Re: Database setup

2012-10-30 Thread Jirka Vejrazka
Hi Markus,

  I don't think you mentioned what OS you use on your machine with Django.

  If it helps, I had this in my settings.py when connecting to MS SQL
database from Linux

'mssql': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'mdb',
'USER': USERNAME,
'PASSWORD': PASSWORD,
'OPTIONS': {
'driver': 'FreeTDS',
'encoding': 'latin1',  # see django-pyodbc issue #24
# UAPM uses SQL_Latin1_General_CP1_CI_AS
'dsn': 'mssql', # see /etc/odbc.ini
},

  There was some extra client libraries installed and a configuration
had to be do be done for system ODBC. Can't help you there, memory
failing :)

  HTH

   Jirka

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



Re: Scaling django (nginx + apache + mod_wsgi + postgresql)

2012-10-30 Thread Tom Evans
On Tue, Oct 30, 2012 at 7:35 AM, Isaac XXX  wrote:
> Hi Tom,
>
> you're right, I was not really explicit about what were my lacks of
> information. Right now, the following points are the ones I can't found a
> howto for the desired deployment:
>
> - Create a master-slave system on postgresql, maintaining all systems up to
> date, distributing reads, and centralizing writes
> - How to configure a cluster of reverse proxies (a single reverse proxy can
> not be enought, and I need to plan to deploy more than 1 load balancers)
>
> The rest (configure apache with mod_wsgit, configure nginx to serve static
> content and so on), is now solved on my current deployments, so it should
> not be a problem on a distributed environment.
>
> Cheers,
>
> Isaac
>

Hi Isaac

We use a similar setup at $JOB. We run a pair of apache httpd servers,
which serve static content and reverse proxy to other http servers
(usually apache again, sometimes not) for dynamic content. The
requests are distributed evenly between the two proxies by our
routers, which round robin connections between the two of them. This
is basically your setup, but we use Apache, because we know it and can
tune it to give nginx like performance anyway.

Actually, that's only half of it - each proxy has all of the public
IPs we serve allocated on lo0 (loopback), and the requests are round
robin routed via a pair of high availability addresses. Therefore, on
both boxes, apache listens on the 'right' IPs. If we ever want to run
with just one proxy, we can 'down' one of the HA addresses on the
server we wish to update, which moves that HA address to be active on
the other proxy, which then serves all the requests.

Now, did we need to do any of this? Probably not! We serve in the
region of 3-5 million requests a day, with peaks of around 200
concurrent requests/s going through the proxies. Apache uses in total
500MB of RAM, pre-tuned to serve up to 768 concurrent req/s without
requiring extra resources. Load average on the boxes never goes above
0.05, even if we put all the requests through one machine. It's nice
having a spare for such a critical part of infrastructure though.

pgsql scaling is a little more involved than MySQL, which is what
we've always used here - usually because it's replication systems are
so good. You will typically need to use some external software to
manage the replication, eg Slony, but don't take my word for it, very
limited pgsql experience.

Cheers

Tom

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



Re: Scaling django (nginx + apache + mod_wsgi + postgresql)

2012-10-30 Thread Kurtis Mullins
The easiest thing I've found to use is simply uWSGI with Nginx. It's easy
to just create new Django servers on the fly. You simply include the IPs in
a list and it will use various algorithms (optional) to distribute the
requests appropriately.

As a lot of applications are IO bound, you could also use a distributed
database system to help with your scalability. I don't have much experience
in that area, though.

This still leaves a point of failure: Nginx (or whatever load balancer or
reverse proxy you use). Maybe someone else here will know more about load
balancing Nginx itself ... that might require specialized hardware. I know
a lot of cloud services offer load balancers (e.g. rackspace) so you could
possibly use that with multiple nginx servers and further multiple django
servers.

On Tue, Oct 30, 2012 at 3:42 AM, Isaac XXX  wrote:

> Hi there,
>
> maybe you're right, but I'm not really worried about RAM footprint, or
> resources consumption. I'm concerned now on architecture, setting a right
> scalable system, and a right cluster of systems, without lacks of
> communications between them.
>
> Underlaying technologies can be easily replaced (say apache-mod_wsgi for
> gunicorn or uwsgi), and some performance improvements can be made, but this
> is not what I'm looking for. I'm looking for the tools to generate a robust
> system, balancing requests through several systems, and allowing increase
> the size of this system (adding more servers) without trouble.
>
> Cheers,
>
> Isaac
>
>
> On 10/29/2012 05:18 PM, Some Developer wrote:
>
>> On 29/10/2012 16:03, Isaac XXX wrote:
>>
>>> Hi there,
>>>
>>> thank you for response Tom.
>>>
>>> Actually, I've a complete idea at how to build this system, but I lack
>>> the exact information about how to join systems, and what I was looking for
>>> was a source of cohesive information on all systems. At least, when I
>>> finish to build that system, I will write this tutorial.
>>>
>>> For someone who can help me, I will describe here what I thought it can
>>> be this structure:
>>>
>>> - 1 nginx, as a reverse proxy on frontend, serving static/media and
>>> redirecting content to apache clusters
>>> - n apache servers, with mod_wsgi, serving dynamic data
>>> - m postgresql servers, in a master-slave flavour
>>>
>>> Cheers,
>>>
>>> Isaac
>>>
>>
>> Why not just ditch Apache entirely and just use Nginx for serving all
>> media (both static and dynamic)? You can then save quite a few resources as
>> you only need to run one HTTP server rather than two.
>>
>> Using Nginx to serve Django content works well. Just serve your Django
>> application via FastCGI or uWSGI and you'll significantly simplify your
>> configuration and reduce RAM usage on your servers as well.
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

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



Re: Scaling django (nginx + apache + mod_wsgi + postgresql)

2012-10-30 Thread Isaac XXX

Hi there,

maybe you're right, but I'm not really worried about RAM footprint, or 
resources consumption. I'm concerned now on architecture, setting a 
right scalable system, and a right cluster of systems, without lacks of 
communications between them.


Underlaying technologies can be easily replaced (say apache-mod_wsgi for 
gunicorn or uwsgi), and some performance improvements can be made, but 
this is not what I'm looking for. I'm looking for the tools to generate 
a robust system, balancing requests through several systems, and 
allowing increase the size of this system (adding more servers) without 
trouble.


Cheers,

Isaac

On 10/29/2012 05:18 PM, Some Developer wrote:

On 29/10/2012 16:03, Isaac XXX wrote:

Hi there,

thank you for response Tom.

Actually, I've a complete idea at how to build this system, but I 
lack the exact information about how to join systems, and what I was 
looking for was a source of cohesive information on all systems. At 
least, when I finish to build that system, I will write this tutorial.


For someone who can help me, I will describe here what I thought it 
can be this structure:


- 1 nginx, as a reverse proxy on frontend, serving static/media and 
redirecting content to apache clusters

- n apache servers, with mod_wsgi, serving dynamic data
- m postgresql servers, in a master-slave flavour

Cheers,

Isaac


Why not just ditch Apache entirely and just use Nginx for serving all 
media (both static and dynamic)? You can then save quite a few 
resources as you only need to run one HTTP server rather than two.


Using Nginx to serve Django content works well. Just serve your Django 
application via FastCGI or uWSGI and you'll significantly simplify 
your configuration and reduce RAM usage on your servers as well.




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



Re: Scaling django (nginx + apache + mod_wsgi + postgresql)

2012-10-30 Thread Isaac XXX
Thank you so much for tips. I will keep them when I start to test 
environment for performance.


Cheers

Isaac

On 10/29/2012 06:44 PM, Cal Leeming [Simplicity Media Ltd] wrote:

Hi Isaac,

If there is one thing I have learnt about scaling apps, it's about 
trying things out for yourself.


Sure there are some best practice guidelines (i.e. serving files from 
nginx, or using apache's X-SendFile rather than streaming out via the 
webapp), but if someone comes along and tells you to use X instead of 
Y, then you don't get the advantages of learning "the hard way".


Another important note is that scaling rarely goes up on a 1:1 ratio, 
i.e. the configuration and resources required to handle X number of 
requests/sec, may be completely different if you need to handle Y 
number of requests/sec.


And often what works for one person, won't work for another (scaling 
is entirely dependant on your application, despite what any of these 
cloud providers might tell you!)


In my own experience, I've found that;

* SSDs with Percona MySQL, resolves a LOT of performance problems - 
but don't abuse it

* Lots and lots and lots of query tuning and InnoDB tuning
* New Relic to identify bottlenecks
* IO contention is a big thing
* Snowball prevention (i.e. you set max clients to X, your backend 
can't handle it, your requests stack up, the load balancer forces time 
out, and your database gets smashed - or you set max memory too high, 
server goes into swap etc).

* uWSGI + nginx is amazing
* Identify where your bottlenecks are (in my own experience, IO/memory 
tends to come up more often than CPU)


Sadly I haven't tried PSQL so I can't offer any advice on this - 
Percona are dragging MySQL kicking and screaming into the 21st century 
and really doing some amazing things, but it's by no means perfect!


The above has helped us grow past 8k-12k requests/minute, the largest 
database we manage is around 1.1 billion rows weighing in at 160GB+, 
and we maintain around 60+ servers.


I should reiterate, the above is purely based on my own experience and 
use cases - I am by no means an expert on the subject and I'm still 
learning approaches on a daily basis - so this is really meant as 
"food for thought" rather than a "this is how you should do things".


Hope this helps a bit!

Cal

On Mon, Oct 29, 2012 at 2:42 PM, Isaac XXX > wrote:


Hi folks,

I'm developing a new application that should get high traffic.
Right now, I've other projects with the follow architecture:

Nginx on front: serving static content and redirecting to apache
for dynamic data
Apache+mod_wsgi: serving dynamic pages
PostgreSQL: backend for data storage (RDBM)
Memcache: for caching purposes :)

All my deployments use a single server, with single
frontend/backend (1 nginx, 1 apache, 1 postgresql). The
requirements for this new project are really large, and I think I
will need to scale all system. Can anyone suggest me an all-in-one
tutorial, discussing the main points on scale a system?

I know there are different alternatives for DB (master-slave,
clustering...), nginx can serve as a reverse proxy or not... and I
need to merge all this information in a single scalable system,
but I can't find an unified source of information.

Can anyone help me on it?

-- 
You received this message because you are subscribed to the Google

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


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

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


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



Re: Scaling django (nginx + apache + mod_wsgi + postgresql)

2012-10-30 Thread Isaac XXX

Hi Tom,

you're right, I was not really explicit about what were my lacks of 
information. Right now, the following points are the ones I can't found 
a howto for the desired deployment:


- Create a master-slave system on postgresql, maintaining all systems up 
to date, distributing reads, and centralizing writes
- How to configure a cluster of reverse proxies (a single reverse proxy 
can not be enought, and I need to plan to deploy more than 1 load balancers)


The rest (configure apache with mod_wsgit, configure nginx to serve 
static content and so on), is now solved on my current deployments, so 
it should not be a problem on a distributed environment.


Cheers,

Isaac

On 10/29/2012 05:23 PM, Tom Evans wrote:

On Mon, Oct 29, 2012 at 4:03 PM, Isaac XXX  wrote:

Hi there,

thank you for response Tom.

Actually, I've a complete idea at how to build this system, but I lack the
exact information about how to join systems, and what I was looking for was
a source of cohesive information on all systems. At least, when I finish to
build that system, I will write this tutorial.

For someone who can help me, I will describe here what I thought it can be
this structure:

- 1 nginx, as a reverse proxy on frontend, serving static/media and
redirecting content to apache clusters
- n apache servers, with mod_wsgi, serving dynamic data
- m postgresql servers, in a master-slave flavour

Cheers,

Isaac


I'm confused about what you are confused about - you seem to grasp
precisely what is required.

IE, which of the following Qs are you stuck at:

How to configure nginx to reverse proxy and balance to other http servers?
How to configure apache, mod_wsgi and django?
How to configure pgsql in a master/multiple slave environment?
How to configure django to issue write requests to the write master,
and distribute reads to read-only slaves?


Cheers

Tom



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



Re: Database setup

2012-10-30 Thread Markus Christen

>
> What i know now:
>  
>
-- 

>  
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.mysql',
> 'NAME': 'baan5c',
> 'USER': '***',
> 'PASSWORD': '*',
> 'HOST': 'MAURITIUS',
> 'PORT': '1433',
> }
> }
>
-- 

>  
> This will works, if my DB is a mysql. But I use MsSql.
> The pyodbc is installed and i made connects over it, to the DB. But for 
> settings.py, i cant find the base.py of this pyodbc.
> Any idea where i can find it?
>

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



Re: signals documentation question

2012-10-30 Thread Mike Dewhirst

Russell

I haven't gotten around to using signals just yet so it will be a while 
before I can suck it and see. I was just reading up because they look 
like a solution to a particular design problem I have. I've gone back to 
the specs for the moment.


Thanks for the fast response.

Cheers

Mike

On 30/10/2012 4:55pm, Russell Keith-Magee wrote:


On Tue, Oct 30, 2012 at 1:40 PM, Mike Dewhirst > wrote:

The 1.5 docs say ...

Where should this code live?
You can put signal handling and registration code anywhere you like.
However, you'll need to make sure that the module it's in gets
imported early on so that the signal handling gets registered before
any signals need to be sent. This makes your app's models.py a good
place to put registration of signal handlers.

... and my question:

When models live in a models directory instead of models.py, should
the signal handling and registration code go in __init__.py where
the models are imported?


There isn't really going to be a *good* answer for this, due to the
general problems that exist with having  reliable, one-time-import-only
startup routine. __init__.py is probably as good a place as any (modulo
the usual arguments against putting code in __init__.py); the actual
files providing the models would be another candidate location.

However, this will all depend on the exact import patterns that exist in
your own code. Even putting signals in a 'normal' models.py file can be
problematic, depending on how you import your code. Essentially -- suck
it and see; if you start seeing multiple signals being fired
unexpectedly, investigate the ways your code is being imported, and
either simplify those imports, or find another location to put the
registrations.

As an aside -- this is one of the reasons we need help landing the #3591
app-refactor branch. One of the side effects of this branch will be a
reliable startup mechanism for apps, which will provide somewhere you
can put code (like signal registrations) that needs to be invoked
exactly once at the startup of the stack.

Yours,
Russ Magee %-)

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


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



psycopg2.DataError

2012-10-30 Thread jondbaker
When I run 'python manage.py validate' the following error is returned:

*psycopg2.DataError: invalid value for parameter "TimeZone": "UTC"*
*
*
settings.py
TIME_ZONE = 'America/Denver'
USE_TZ = True

I'm using Django 1.4.2 with Postgres 9.1/PostGIS on OSX.

To test, I went back and commented out my custom apps in INSTALLED_APPS, 
but the error is still there. If I set USE_TZ to False, then the error 
becomes:
*psycopg2.DataError: invalid value for parameter "TimeZone": 
"America/Denver"*

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