Re: How to Create Super User account in any Django Website?

2013-10-08 Thread Harjot Mann
On Wed, Oct 9, 2013 at 1:38 AM, Mamarth Briton  wrote:
> I found many Journalist creating super user account in many Django website.
> Does any one know how to create super user account in Django website. Such
> tonganoxiemirror.com is a Django site where I want to create a super user
> account or a Staff account without support of that site's admin. I didn't
> got any answer from that site's administrator to create a Staff Account.

Use "python manage.py createsuperuser" command and give the username,
emailis and password. You are done.

-- 
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

-- 
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/CAB0GQhDpm%2BtMHcufKJDKCARoG2RwvUia_%3DM-TBQAox-6ujHV9w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to Create Super User account in any Django Website?

2013-10-08 Thread Russell Keith-Magee
Hi Mamarth,

Put it this way -- if you're already an admin user, the answer will be
pretty obvious. If you're not an admin user, you can't -- and that's by
design.

Creating a super user account in Django is just a matter of flicking the
"superuser" flag on an existing user's account -- however, you'll need to
have an existing super user account (or an admin user with permission to
modify User objects) to be able to do this.

If you've got access to the computer on which the site is installed, you
can use the createsuperuer management command [1] to create a new user.

[1] https://docs.djangoproject.com/en/1.5/ref/django-admin/#createsuperuser

If you don't have an existing admin or superuser account, and you don't
have access to the machine hosting the site, then you've got a problem.
You'll need the assistance of the site administrator to go any further.

Yours.
Russ Magee %-)



On Wed, Oct 9, 2013 at 4:08 AM, Mamarth Briton  wrote:

> Hi,
>
> I found many Journalist creating super user account in many Django
> website. Does any one know how to create super user account in Django
> website. Such tonganoxiemirror.com is a Django site where I want to
> create a super user account or a Staff account without support of that
> site's admin. I didn't got any answer from that site's administrator to
> create a Staff Account.
>
> --
> 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/398ee05c-2f41-4a68-9265-49c8647c8239%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

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


Re: __unicode__() addition not working in basic poll application.

2013-10-08 Thread Brachamul
Could someone post what the entire "models.py" file should look like at 
this point?
I don't think I have indendation problems, but I'm new to both Python & 
Django, so I can't be sure.
Using Python 2.7.5 and Django 1.4.

-- 
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/8aa3f7ef-4252-494e-9334-9f40578a5e8e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


How to Create Super User account in any Django Website?

2013-10-08 Thread Mamarth Briton
Hi,

I found many Journalist creating super user account in many Django website. 
Does any one know how to create super user account in Django website. Such 
tonganoxiemirror.com is a Django site where I want to create a super user 
account or a Staff account without support of that site's admin. I didn't 
got any answer from that site's administrator to create a Staff Account.

-- 
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/398ee05c-2f41-4a68-9265-49c8647c8239%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Nginx versus Apache

2013-10-08 Thread Mando
+1 nginx+uWSGI

On Tuesday, October 8, 2013 7:16:42 AM UTC-5, Andréas Kühne wrote:
>
> Hi,
>
> I was wondering, which server would be best for a production environment. 
> Nginx or apache? At the moment we are running both, nginx for static files 
> and apache + mod_wsgi for django. But in the future we will be moving our 
> static assets to S3 and cloudfront, so the reason for using nginx for that 
> will be gone. 
>
> So now I am wondering which of the 2 webservers is the fastest and most 
> efficient in serving a django website?
>
> Regards,
>
> Andréas
>  

-- 
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/1b3eaf09-e677-4d18-9b45-35cb32b4ee8e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Nginx versus Apache

2013-10-08 Thread Juan Pablo Martínez
+1 nginx+gunicorn


On Tue, Oct 8, 2013 at 5:09 PM, Mando  wrote:

> +1 nginx+uWSGI
>
>
> On Tuesday, October 8, 2013 7:16:42 AM UTC-5, Andréas Kühne wrote:
>>
>> Hi,
>>
>> I was wondering, which server would be best for a production environment.
>> Nginx or apache? At the moment we are running both, nginx for static files
>> and apache + mod_wsgi for django. But in the future we will be moving our
>> static assets to S3 and cloudfront, so the reason for using nginx for that
>> will be gone.
>>
>> So now I am wondering which of the 2 webservers is the fastest and most
>> efficient in serving a django website?
>>
>> Regards,
>>
>> Andréas
>>
>  --
> 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/1b3eaf09-e677-4d18-9b45-35cb32b4ee8e%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
juanpex

-- 
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/CABPLwmC0KzazUTf4-M-i9hnsbcdzNTjpVw7zb-qRVKqypiogtA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to Sign In as a admin or Staff in Django Site?

2013-10-08 Thread Andrew Farrell
Hi Mamarth,

Follow the directions under "Overview" here: 
https://docs.djangoproject.com/en/1.6/ref/contrib/admin/, found by googling 
"django admin site"
Create a staff account with the command `manage.py createsuperuser`,
and then go to yoursite.com/admin/ (or localhost:8000/admin/) to sign in 
with that account.

On Tuesday, October 8, 2013 1:31:03 PM UTC-4, Mamarth Briton wrote:
>
> Hi,
>
>
>
> How to Sign In as a admin or Staff in Django Site? Dose anybody know about 
> admin url creation?
>

-- 
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/fb4dd795-9d53-43b8-9ada-05831ec693ea%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-08 Thread Ramiro Morales
On Tue, Oct 8, 2013 at 11:42 AM, Hélio Miranda  wrote:
>
> Hi
> Here I am having a problem which is as follows:
> I 'm getting parameters via post to make querys depending on paramtros I are 
> passed ... doing gender filters.
> So I'm doing well
> def filter(request):
> if request.method == 'POST':
> namepost = request.POST.get('name')
> surnamepost = request.POST.get('surname')
>
> if namepost != None and surnamepost != None:
> result = [a.get_json() for a in 
> Player.objects.filter((Q(name=namepost) & Q(surname=surnamepost)))]
>elif namepost != None and surnamepost == None:
> result = [a.get_json() for a in 
> Player.objects.filter(name=namepost)]
>
> data = {"meta": {"total_count":len(result)}, "objects": result}
> aa = json.dumps(data)
> return HttpResponse(aa, content_type='application/json')
>
> Is working properly , the problem is :
> If it were only these two parameters , there was no problem , was to complete 
> the rest of the hypotheses ... the problem is that I can have up to 10 
> parameters passed by post to the filters , and I never know which are passed 
> , can be 1 , 2, 4, ... as the user makes the filter ...
>
> But doing so would take a lot of ifs , it would have many chances ...
> is there any way I can do this another way ?
> Someone can help me ?

I can't thes this now but hopefully something similar to thois could
be of help: https://dpaste.de/FTnt

-- 
Ramiro Morales
@ramiromorales

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


Re: How to Sign In as a admin or Staff in Django Site?

2013-10-08 Thread Nigel Legg
See the tutorial in the django documentation.

Cheers, Nigel
07914 740972



On 8 October 2013 18:31, Mamarth Briton  wrote:

> Hi,
>
>
>
> How to Sign In as a admin or Staff in Django Site? Dose anybody know about
> admin url creation?
>
> --
> 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/776fbe72-5fe0-429c-a91e-6089e7af6b3d%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

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


Re: How to Query account/profile information for multiple account and allowing user edit or update acount

2013-10-08 Thread Okorie Emmanuel
Thanks for your response

This is what i want to do,
I want to create an app that have two different users
that is teachers(one type of user) and student(another type of user)
the problem is how to create them without using 

AUTH_USER_MODEL = 'myapp.MyUser'
since it is  for one kind of user only.

I have created the model as shown in last post
but how to query individual details in their 
respective profile is the problem.

Any way out. thanks 

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


Re: PyCons in Africa

2013-10-08 Thread Alex Strickland

On 2013-10-04 06:13 PM, Daniele Procida wrote:


First of all, apologies if you have to read this more than once because of the 
cross-posting.

I've had an idea brewing recently.

I went to meet Professor Judith Hall this afternoon to talk about it. She's 
involved with http://medicine.cardiff.ac.uk/mothers-africa/ (amongst other 
things) and is working on a Cardiff University project which itself is part of 
http://wales.gov.uk/topics/health/improvement/index/grants/?lang=en

Following that meeting, I bashed out: 
https://github.com/evildmp/pycons-in-africa/ - please take a look, and even 
better, let me know what you think, or make your own contribution to the 
document. I'll continue working on it myself.


This just happened in Cape Town:

http://za.pycon.org/

I didn't go (or know about it at the time).

--
Regards
Alex

--
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/52531A8B.90801%40mweb.co.za.
For more options, visit https://groups.google.com/groups/opt_out.


How to Sign In as a admin or Staff in Django Site?

2013-10-08 Thread Mamarth Briton
Hi,



How to Sign In as a admin or Staff in Django Site? Dose anybody know about 
admin url creation?

-- 
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/776fbe72-5fe0-429c-a91e-6089e7af6b3d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Ho can I reverse urls inside urls.py?

2013-10-08 Thread Bill Freeman
The problem is that reverse works by querying the structure that is defined
by importing the urls modules.

A possible cheap trick is to create your dictionary in a module global,
passing that to the url call, in which case you could later import the
module and patch the "post_reset_redirect' item with data that you could
then get from reverse.

But, IIRC, urls may not be imported until the first request, so it may be
tricky finding a place to put this code.

Bill


On Tue, Oct 8, 2013 at 11:11 AM, DJ-Tom  wrote:

> Based on this 
> articleI
>  implemented a password reset function.
>
> Unfortunately, currently this only works on the development server because
> the base URLs for the post_reset_redirect are different on the production
> server.
>
> This is the relevant part of my urls.py, I marked the prolematic parts in
> red:
>
> 
> url(r'^password/reset/$','django.contrib.auth.views.password_reset',{'post_reset_redirect'
> : '/accounts/password/reset/done/', 'template_name':
> 'accounts/password_reset.html'}, name="password_reset"),\
>
> (r'^password/reset/done/$','django.contrib.auth.views.password_reset_done',{'template_name':
> 'accounts/password_reset_done.html'}), \
>
> (r'^password/reset/(?P[0-9A-Za-z]+)-(?P.+)/$','django.contrib.auth.views.password_reset_confirm',{'post_reset_redirect'
> : '/accounts/password/done/', 'template_name':
> 'accounts/password_reset_confirm.html'}),\
> (r'^password/done/$',
> 'django.contrib.auth.views.password_reset_complete',{'template_name':
> 'accounts/password_reset_complete.html'}),
> )
>
> Normally I would use
> reverse('django.contrib.auth.views.password_reset_done') to get the correct
> URL, but using reverse() inside the urls.py leads to a configuration error,
> so how can I put the correct URLs here so it works correct both in
> development and production?
>
> Thanks
> Thomas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> 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/357ee849-a323-417b-b17a-79cf8e648a61%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

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


Re: Ho can I reverse urls inside urls.py?

2013-10-08 Thread Tom Evans
On Tue, Oct 8, 2013 at 4:11 PM, DJ-Tom  wrote:
> Based on this article I implemented a password reset function.
>
> Unfortunately, currently this only works on the development server because
> the base URLs for the post_reset_redirect are different on the production
> server.
>
> This is the relevant part of my urls.py, I marked the prolematic parts in
> red:
>
>
> url(r'^password/reset/$','django.contrib.auth.views.password_reset',{'post_reset_redirect'
> : '/accounts/password/reset/done/', 'template_name':
> 'accounts/password_reset.html'}, name="password_reset"),\
>
> (r'^password/reset/done/$','django.contrib.auth.views.password_reset_done',{'template_name':
> 'accounts/password_reset_done.html'}), \
>
> (r'^password/reset/(?P[0-9A-Za-z]+)-(?P.+)/$','django.contrib.auth.views.password_reset_confirm',{'post_reset_redirect'
> : '/accounts/password/done/', 'template_name':
> 'accounts/password_reset_confirm.html'}),\
> (r'^password/done/$',
> 'django.contrib.auth.views.password_reset_complete',{'template_name':
> 'accounts/password_reset_complete.html'}),
> )
>
> Normally I would use
> reverse('django.contrib.auth.views.password_reset_done') to get the correct
> URL, but using reverse() inside the urls.py leads to a configuration error,
> so how can I put the correct URLs here so it works correct both in
> development and production?
>
> Thanks
> Thomas
>

Use reverse_lazy

https://docs.djangoproject.com/en/1.5/ref/urlresolvers/#reverse-lazy


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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1LNXwxyi9pSfjU%2BmJ1%2Bhfyo52bzgzWeRYkZ042_NVN7sA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Ho can I reverse urls inside urls.py?

2013-10-08 Thread DJ-Tom
Based on this 
articleI
 implemented a password reset function.

Unfortunately, currently this only works on the development server because 
the base URLs for the post_reset_redirect are different on the production 
server.

This is the relevant part of my urls.py, I marked the prolematic parts in 
red:


url(r'^password/reset/$','django.contrib.auth.views.password_reset',{'post_reset_redirect'
 
: '/accounts/password/reset/done/', 'template_name': 
'accounts/password_reset.html'}, name="password_reset"),\

(r'^password/reset/done/$','django.contrib.auth.views.password_reset_done',{'template_name':
 
'accounts/password_reset_done.html'}), \

(r'^password/reset/(?P[0-9A-Za-z]+)-(?P.+)/$','django.contrib.auth.views.password_reset_confirm',{'post_reset_redirect'
 
: '/accounts/password/done/', 'template_name': 
'accounts/password_reset_confirm.html'}),\
(r'^password/done/$', 
'django.contrib.auth.views.password_reset_complete',{'template_name': 
'accounts/password_reset_complete.html'}),
)

Normally I would use 
reverse('django.contrib.auth.views.password_reset_done') to get the correct 
URL, but using reverse() inside the urls.py leads to a configuration error, 
so how can I put the correct URLs here so it works correct both in 
development and production?

Thanks
Thomas

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
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/357ee849-a323-417b-b17a-79cf8e648a61%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Query parameters for receiving post

2013-10-08 Thread Hélio Miranda
Hi
Here I am having a problem which is as follows:
I 'm getting parameters via post to make querys depending on paramtros I 
are passed ... doing gender filters.
So I'm doing well
*def filter(request):*
*if request.method == 'POST':*
*namepost = request.POST.get('name')*
*surnamepost = request.POST.get('surname')*
*
*
*if namepost != None and surnamepost != None:*
*result = [a.get_json() for a in 
Player.objects.filter((Q(name=namepost) & Q(surname=surnamepost)))]*
*   elif namepost != None and surnamepost == None:*
*result = [a.get_json() for a in 
Player.objects.filter(name=namepost)]*
**
*data = {"meta": {"total_count":len(result)}, "objects": result}*
*aa = json.dumps(data)*
*return HttpResponse(aa, content_type='application/json')*

Is working properly , the problem is :
If it were only these two parameters , there was no problem , was to 
complete the rest of the hypotheses ... the problem is that I can have up 
to 10 parameters passed by post to the filters , and I never know which are 
passed , can be 1 , 2, 4, ... as the user makes the filter ...

But doing so would take a lot of ifs , it would have many chances ...
is there any way I can do this another way ?
Someone can help me ?

-- 
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/fc851085-d5bb-4567-b830-d25cdd66e499%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Nginx versus Apache

2013-10-08 Thread Vernon D. Cole
If you are doing any of the hundred-odd things that Apache can do an Nginx 
cannot, then you will need to use Apache.  But, if all you are doing is 
serving static files and handing all heavy lifting to django, then Nginx 
with uWSGI will do everything you need, and will do it with less resources.

On Tuesday, October 8, 2013 1:16:42 PM UTC+1, Andréas Kühne wrote:
>
> Hi,
>
> I was wondering, which server would be best for a production environment. 
> Nginx or apache? At the moment we are running both, nginx for static files 
> and apache + mod_wsgi for django. But in the future we will be moving our 
> static assets to S3 and cloudfront, so the reason for using nginx for that 
> will be gone. 
>
> So now I am wondering which of the 2 webservers is the fastest and most 
> efficient in serving a django website?
>
> Regards,
>
> Andréas
>  

-- 
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/da4ead75-4aac-4cbb-b727-1ff8fcca46b1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Nginx versus Apache

2013-10-08 Thread Victor Manuel Quiñones Victor
+1 Nginx


On Tue, Oct 8, 2013 at 10:06 AM, Valder Gallo  wrote:

> +1 nginx
>
>
> On Tue, Oct 8, 2013 at 9:16 AM, Andreas Kuhne 
> wrote:
>
>> Hi,
>>
>> I was wondering, which server would be best for a production environment.
>> Nginx or apache? At the moment we are running both, nginx for static files
>> and apache + mod_wsgi for django. But in the future we will be moving our
>> static assets to S3 and cloudfront, so the reason for using nginx for that
>> will be gone.
>>
>> So now I am wondering which of the 2 webservers is the fastest and most
>> efficient in serving a django website?
>>
>> Regards,
>>
>> Andréas
>>
>> --
>> 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/CALXYUbk2Sv6ia%3DhgHxDw%2BH0f6w89ys-q0zj7LDfBXWEKnENs_A%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> Valder Gallo
> +55 11 9949 2911
> +55 11 2532 2911
> Skype: valdergallo
> @valdergallo
> www.valdergallo.com.br
>
> --
> 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/CAPjQhUU_n18vJCzpwDq_QikN2406Z7kizEscLwKSK61m1CM%2B7A%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Quiñones Victor Manuel
Tel: +54 0362 15 4 880839
Resistencia - 3500
Argentina

-- 
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/CABV2brhotnqRd7Vn8RafLc1uVSc_HuJP7%2B296pmNhn5MoagFxw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django model(s) silently fails to sync to the DB ( for no apparent reason )

2013-10-08 Thread Rene Zelaya
Hey Doug,

Any chance you haven't included those models in the INSTALLED_APPS in your 
settings.py file?

Best,
Rene

On Monday, October 7, 2013 9:40:33 PM UTC-4, Doug S wrote:
>
> I don't think I'm making a rookie mistake, I've looked over my code 
> several times.
> I've got two pretty simple django models that are just failing to sync to 
> the db
> during the syncdb there are no errors, even with --verbosity 3
> When I try to make a relation to them I get an error saying the models 
> either don't exist or a re abstract
> In fact when I examine the DB, they are not there.
> syncdb is attempting to sync models before and after these 2 models in the 
> same file.
> I've dropped my DB and started from scratch several times
> I don't know how to debug this issue because I don't know how syncdb works 
> under the covers and what can go wrong.
> Here are my models, they look pretty simple to me:
>
> class DirEnumVal(models.Model):
>
> str_val = models.CharField(max_length=64, default='')
>
> def unicode(self):
>
> return self.str_val
>
> class DirAttr(models.Model):
>
> 
>
> BOOL = 'BOOL'
>
> MONO = 'MONO'
>
> SCAL = 'SCAL'
>
> ENUM = 'ENUM'
>
> 
>
> TYPES = (
>
> (BOOL,'Boolean'),
>
> (MONO,'Monomial'),
>
> (SCAL,'Scalar'),
>
> (ENUM,'Enumeration'),
>
> )
>
> 
>
> val_type = models.CharField(max_length=4, choices=TYPES)
>
> val_key = models.CharField(max_length=32)
>
> default_bool = models.BooleanField(default=True)
>
> default_num = models.IntegerField(default = 0)
>
> default_float = models.FloatField(default=1.0)
>
> enum_choices = models.ManyToManyField(DirEnumVal, null=True, blank=
> True)
>
> default_choice = models.CharField(max_length=64, default='')
>
> required = models.BooleanField(default=True)
>
> 
>
> def unicode(self):
>
> return '{k} :=> {t} ( default = {d} )'.format(
>
> k=self.val_key, t=self.val_type, d=self.default())
>
> I am using a pattern with multiple model files for a single app
>
> my dir structure is:
>
> >app
>
>  > models
>
> - __init__.py 
>
> - model_file1.py
>
> - model_file2.py
>
> and in my __init__.py I've got code to pull all the models together into 
> one module:  app.models
>
>   from __future__ import absolute_import
>
>   from .model_file1 import model1a,model1b,model1c
>
>   from .model_file2 import model2a,model2b,model2c
>
> This way of importing the models has been working long before this trouble 
> of models not being synched came up.
>
> When I access the django project and settings through a python shell I can 
> import the models and instatiate them
>
> but when I save them, PostGres gives me this error:
>
> DatabaseError: current transaction is aborted, commands ignored until end of 
> transaction block
>
>
> This problem surfaced after I installed django-categories and set up some 
> category models.
>
> I had some trouble at first setting that up but I've got the BaseCategory 
> subclasses behaving nicely now
>
> and have started with a fresh DB.
>
> At some point when I was getting django categories to work there was an error 
> when I synched the DB
>
> that said something about an unexcepted special character being somewhere in 
> my code or the django-categories code.
>
> That seemed suspicious but that doesn't show up anymore and I'm using a fresh 
> DB.
>
>
> Does anybody see anything obvious or know what type of problems can cause 
> syncdb to ignore models?
>
> I'm running out of ideas about what is wrong
>
> I'm on Django 1.5 using PostGreSQL & MacOS Lion
>
> Best Doug
>

-- 
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/29eb0976-3a4b-4210-a78d-aab8c296180a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Nginx versus Apache

2013-10-08 Thread Valder Gallo
+1 nginx


On Tue, Oct 8, 2013 at 9:16 AM, Andreas Kuhne wrote:

> Hi,
>
> I was wondering, which server would be best for a production environment.
> Nginx or apache? At the moment we are running both, nginx for static files
> and apache + mod_wsgi for django. But in the future we will be moving our
> static assets to S3 and cloudfront, so the reason for using nginx for that
> will be gone.
>
> So now I am wondering which of the 2 webservers is the fastest and most
> efficient in serving a django website?
>
> Regards,
>
> Andréas
>
> --
> 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/CALXYUbk2Sv6ia%3DhgHxDw%2BH0f6w89ys-q0zj7LDfBXWEKnENs_A%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Valder Gallo
+55 11 9949 2911
+55 11 2532 2911
Skype: valdergallo
@valdergallo
www.valdergallo.com.br

-- 
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/CAPjQhUU_n18vJCzpwDq_QikN2406Z7kizEscLwKSK61m1CM%2B7A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Nginx versus Apache

2013-10-08 Thread Andreas Kuhne
Hi,

I was wondering, which server would be best for a production environment.
Nginx or apache? At the moment we are running both, nginx for static files
and apache + mod_wsgi for django. But in the future we will be moving our
static assets to S3 and cloudfront, so the reason for using nginx for that
will be gone.

So now I am wondering which of the 2 webservers is the fastest and most
efficient in serving a django website?

Regards,

Andréas

-- 
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/CALXYUbk2Sv6ia%3DhgHxDw%2BH0f6w89ys-q0zj7LDfBXWEKnENs_A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query field with reference

2013-10-08 Thread Hélio Miranda
I managed to solve the problem, I did so:
*result = [a.get_json() for a in 
Player.objects.filter(position__in=Position.objects.filter(name=positionpost))]
*

Thanks for the trouble

-- 
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/bcaf95d0-549b-4249-af86-ae1392cfe437%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: define BASE_DIR?

2013-10-08 Thread StefanoC
Hello!

as much as I understand / agree the point of not using the dev version/doc 
especially for newbies, I found this 
https://code.djangoproject.com/ticket/20400 ticket about it that was closed 
as invalid.

Shouldn't this be open and valid instead? Otherwise this doc bug would 
never get fixed (in addition it's a worthy addition to the settings as best 
practice in my opinion)?

Stefano

On Wednesday, May 22, 2013 2:06:18 PM UTC+2, Tom Evans wrote:
>
> On Tue, May 21, 2013 at 10:08 PM, Christopher Spears 
>  wrote: 
> > I am working my way through the Django tutorial, and I have reached the 
> part 
> > where I am supposed to customize the look and feel of the admin.  I am 
> > supposed to do that using the mysite\settings.py file (working on a 
> Windows 
> > laptop).  I have two questions. 
> > 
> > At first, I just typed the following into the file: 
> > 
> > TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')] 
> > 
> > I got an error message stating that os.path was not recognized.  I 
> solved 
> > this by putting 'import os.path' at the top of the file.  Does this mean 
> > there is a bug in the tutorial's documentation?  I do not recall seeing 
> any 
> > instructions that told me to add this. 
> > 
> > After I solved the first problem, I now get this error message: 
> > 
> >   File "C:\Users\Chris\Documents\django_dev\mysite\mysite\settings.py", 
> line 
> > 7, 
> > in  
> > TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')] 
> > NameError: name 'BASE_DIR' is not defined 
> > 
> > Am I supposed to now define BASE_DIR? 
> > 
> > Thanks! 
> > 
>
> BASE_DIR is only mentioned in the tutorial from the in development 
> docs, which may not be the best place to start - chiefly because it 
> can have issues like this. 
>
> If you don't mind encountering things like this, then using the dev 
> docs helps find issues like this that have been added since the last 
> release, but if you want a more checked and correct django docs, use 
> the ones from the latest release. 
>
> Of course, you should always use the docs for the version that you are 
> actually using. I would recommend not using unreleased versions of 
> django to learn django though. 
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/41403496-a052-40a2-a8e3-23c75d423796%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query field with reference

2013-10-08 Thread Hélio Miranda
Gives error says:
DD is not a valid ObjectId

For the DD not objectId of reference

-- 
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/80e66eeb-5f84-4e82-8f97-6463fb1227b6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query field with reference

2013-10-08 Thread Leonardo Giordani
I do not know MongoDB, so sorry if I get it wrong. I'd say that you have to
write

*result = [a.get_json() for a in
Player.objects.filter(position__position_name='DD')]
*
since in your attached document you set it this way (line 53).
Try and let me know

Leo


Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/10/8 Hélio Miranda 

> Hi
> I was trying to make a query in a field that has refencia to another
> collection, like this:
> *result = [a.get_json() for a in
> Player.objects.filter(position__name='DD')]*
>
> But it is returning me empty, and I have a player with the position DD
> I'm using mongodb as a database.
>
> In my Document is thus:
> http://plnkr.co/edit/FHH2hZh26OiLMKTk2ToO?p=info
>
> Does anyone know what I'm doing wrong?
>
> thank you
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/47c58f74-484b-4668-9678-7a50fdea842f%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEhE%2BOmUqH2kfcY-Ve0%3D9-HHAtP9sd%2BpyT-358PO9M5Cyq4J%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Query field with reference

2013-10-08 Thread Hélio Miranda
Hi
I was trying to make a query in a field that has refencia to another 
collection, like this:
*result = [a.get_json() for a in Player.objects.filter(position__name='DD')]
*

But it is returning me empty, and I have a player with the position DD
I'm using mongodb as a database.

In my Document is thus:
http://plnkr.co/edit/FHH2hZh26OiLMKTk2ToO?p=info

Does anyone know what I'm doing wrong?

thank you

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