Re: Django apache mod_wsgi permission denied

2012-11-30 Thread Loai Ghoraba
okay it works now, I was just missing a trailing slash at
Alias /static/ /home/loai/workspace/Faculty/Faculty/static/

On Sat, Dec 1, 2012 at 8:17 AM, Loai Ghoraba  wrote:

> a strange thing is that when I remove the   directive so it
> becomes:
>
> 
> Order deny,allow
> Allow from all
> 
>
> instead of
>
> 
> 
> Order deny,allow
> Allow from all
> 
> 
>
> then trying to access any static or media file raises (not found) instead
> of permission denied !
>
> On Sat, Dec 1, 2012 at 7:42 AM, Loai Ghoraba  wrote:
>
>> thanks, but still I can't find what's wrong with the permission
>> thing. The html pages are loaded without static content, no css or js or
>> whatever, neither the media is accessible.
>>
>>
>>
>> On Sat, Dec 1, 2012 at 7:15 AM, Mike Dewhirst wrote:
>>
>>> On 1/12/2012 3:57pm, Loai Ghoraba wrote:
>>>
 thanks, but I have tried this now and it also doesn't work :X though the
 author slides presentation mentioned chmod o+rx on the root dir only.

 On Sat, Dec 1, 2012 at 6:53 AM, Mike Dewhirst **> wrote:

 chmod -R o+rx

>>>
>>> Here is my working apache2 conf for project "proj" on site mydomain.com.
>>> It is running happily on Ubuntu 12.04 with permissions on all /var/www/proj
>>> directories and files rwxrwx---
>>>
>>> This is because I need users in the group to have access but no-one from
>>> outside. Apache is the owner.
>>>
>>> Good luck
>>>
>>> Mike
>>>
>>> # proj ##**###
>>>
>>> 
>>>
>>>  # proj resolves to lenny 109
>>>  DocumentRoot /var/www/proj/htdocs/
>>>  ServerName proj.mydomain.com
>>>  ServerAdmin webmas...@mydomain.com
>>>
>>>  HostnameLookups Off
>>>  UseCanonicalName Off
>>>
>>>  ErrorLog ${APACHE_LOG_DIR}/proj-error.**log
>>>  CustomLog ${APACHE_LOG_DIR}/proj-access.**log combined
>>>
>>>  Alias /robots.txt /var/www/static/proj/robots/**robots.txt
>>>  Alias /favicon.ico /var/www/static/proj/img/proj.**ico
>>>
>>>  # lock the public out
>>>  
>>>   AllowOverride None
>>>   Order deny,allow
>>>   Deny from all
>>>  
>>>
>>>  # serve uploaded media from here
>>>  
>>>   AllowOverride None
>>>
>>>   Order deny,allow
>>>   Allow from all
>>>  
>>>
>>>  # serve static stuff from here
>>>  
>>>   AllowOverride None
>>>
>>>   Order deny,allow
>>>   Allow from all
>>>  
>>>
>>>  
>>>   Alias /media/ /var/www/media/proj/
>>>   Alias /static/ /var/www/static/proj/
>>>   Alias /tiny_mce/ /var/www/static/proj/js/tiny_**mce/
>>>   Alias /jquery/ /var/www/static/proj/js/**jquery/
>>>  
>>>
>>>  
>>>WSGIScriptAlias / /var/www/proj/proj/proj.wsgi
>>>
>>>
>>>  Order deny,allow
>>>  Allow from all
>>>
>>>  
>>>
>>> 
>>>
>>>
>>>
>>>
>>>
>>>
>>>

 --
 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+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: django1.5 subclass AbstractUser, How to get a password-(re)set field in admin

2012-11-30 Thread Bruce Wade
Hi Russ,

Thanks that did solve the problem I was having.

--
Regards,
Bruce


On Fri, Nov 30, 2012 at 9:32 PM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> Hi Bruce,
>
> Update your Django checkout. This problem was fixed in 0fc5878c.
>
> Yours,
> Russ Magee %-)
>
>
> On Fri, Nov 30, 2012 at 2:07 PM, Detectedstealth wrote:
>
>> Hi Russel,
>>
>> I have followed
>> https://docs.djangoproject.com/en/dev/topics/auth/#a-full-example then
>> added:
>>
>> password = ReadOnlyPasswordHashField(label=_("Password"),
>>
>> help_text=_("Raw passwords are not stored, so there is no way to
>> see "
>>
>> "this user's password, but you can change the
>> password "
>>
>> "using this form."),
>> widget=ReadOnlyPasswordHashWidget())
>>
>> From what I seen in django/contrib/auth/forms UserChangeForm this gives
>> me the change password URL however I get the error: 'CustUser' object has
>> no attribute 'username' looking at the error line 136
>>
>> /Library/Python/2.7/site-packages/django/contrib/auth/admin.py in
>> user_change_password
>>
>>1. 'title': _('Change password: %s') %
>>escape(user.username),
>>
>> It looks like this is either a bug or doesn't work with a custom user as
>> planed as it looks for a username even though in the example you set the
>> email to username field with: USERNAME_FIELD = 'email'
>>
>> Am I missing something?
>>
>> Regards,
>> Bruce
>>
>> On Saturday, November 3, 2012 4:09:09 PM UTC-7, Russell Keith-Magee wrote:
>>
>>>
>>> On Sat, Nov 3, 2012 at 11:15 PM, Michael Muster <
>>> michael...@googlemail.com**> wrote:
>>>
 Hi again,

 I have a subclass from AbstractUser

 1 from django.contrib.auth.models import AbstractUser
 2 from django.conf import settings
 3
 4 class cpUser(AbstractUser):
 5 twitter = models.CharField(max_length=**100)
 6 def __unicode__(self):
 7 return self.username

 and
 AUTH_USER_MODEL = 'account.cpUser'
 in my settings.py set.

 How do i get a password field to set and reset
 a password in my admin app?
 Adding the password field to admin.py does obviously not
 work as it enters plain text and not the hashed password.

 1 from django.contrib import admin
 2 class cpUserAdmin(admin.ModelAdmin):
 3fields = ['twitter','username', 'first_name', 'last_name',
 'password',]
 4
  
 5 admin.site.register(cpUser, cpUserAdmin)


 Do i have to set a passwort field to the models.py or
 can i geht that from the models which i "abstracted" from
 (as done with username, first_name, last_name...)

 You need to follow the instructions that are in the documentation.
>>>
>>> https://docs.djangoproject.**com/en/dev/topics/auth/#**
>>> custom-users-and-django-**contrib-admin
>>>
>>> The key is that you can't just subclass admin.ModelAdmin -- you need to
>>> subclass the existing Django admin class for Users
>>> (django.contrib.auth.admin.**UserAdmin) - that base class is what
>>> provides all the special password handling etc for User models.
>>>
>>> Yours,
>>> Russ Magee %-)
>>>
>>  --
>> 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/-/sRmpO1m1Ng0J.
>> 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.
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com

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



Re: Django apache mod_wsgi permission denied

2012-11-30 Thread Loai Ghoraba
a strange thing is that when I remove the   directive so it
becomes:


Order deny,allow
Allow from all


instead of



Order deny,allow
Allow from all



then trying to access any static or media file raises (not found) instead
of permission denied !

On Sat, Dec 1, 2012 at 7:42 AM, Loai Ghoraba  wrote:

> thanks, but still I can't find what's wrong with the permission thing. The
> html pages are loaded without static content, no css or js or whatever,
> neither the media is accessible.
>
>
>
> On Sat, Dec 1, 2012 at 7:15 AM, Mike Dewhirst wrote:
>
>> On 1/12/2012 3:57pm, Loai Ghoraba wrote:
>>
>>> thanks, but I have tried this now and it also doesn't work :X though the
>>> author slides presentation mentioned chmod o+rx on the root dir only.
>>>
>>> On Sat, Dec 1, 2012 at 6:53 AM, Mike Dewhirst >> **> wrote:
>>>
>>> chmod -R o+rx
>>>
>>
>> Here is my working apache2 conf for project "proj" on site mydomain.com.
>> It is running happily on Ubuntu 12.04 with permissions on all /var/www/proj
>> directories and files rwxrwx---
>>
>> This is because I need users in the group to have access but no-one from
>> outside. Apache is the owner.
>>
>> Good luck
>>
>> Mike
>>
>> # proj ##**###
>>
>> 
>>
>>  # proj resolves to lenny 109
>>  DocumentRoot /var/www/proj/htdocs/
>>  ServerName proj.mydomain.com
>>  ServerAdmin webmas...@mydomain.com
>>
>>  HostnameLookups Off
>>  UseCanonicalName Off
>>
>>  ErrorLog ${APACHE_LOG_DIR}/proj-error.**log
>>  CustomLog ${APACHE_LOG_DIR}/proj-access.**log combined
>>
>>  Alias /robots.txt /var/www/static/proj/robots/**robots.txt
>>  Alias /favicon.ico /var/www/static/proj/img/proj.**ico
>>
>>  # lock the public out
>>  
>>   AllowOverride None
>>   Order deny,allow
>>   Deny from all
>>  
>>
>>  # serve uploaded media from here
>>  
>>   AllowOverride None
>>
>>   Order deny,allow
>>   Allow from all
>>  
>>
>>  # serve static stuff from here
>>  
>>   AllowOverride None
>>
>>   Order deny,allow
>>   Allow from all
>>  
>>
>>  
>>   Alias /media/ /var/www/media/proj/
>>   Alias /static/ /var/www/static/proj/
>>   Alias /tiny_mce/ /var/www/static/proj/js/tiny_**mce/
>>   Alias /jquery/ /var/www/static/proj/js/**jquery/
>>  
>>
>>  
>>WSGIScriptAlias / /var/www/proj/proj/proj.wsgi
>>
>>
>>  Order deny,allow
>>  Allow from all
>>
>>  
>>
>> 
>>
>>
>>
>>
>>
>>
>>
>>>
>>> --
>>> 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+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: Django apache mod_wsgi permission denied

2012-11-30 Thread Loai Ghoraba
thanks, but still I can't find what's wrong with the permission thing. The
html pages are loaded without static content, no css or js or whatever,
neither the media is accessible.


On Sat, Dec 1, 2012 at 7:15 AM, Mike Dewhirst  wrote:

> On 1/12/2012 3:57pm, Loai Ghoraba wrote:
>
>> thanks, but I have tried this now and it also doesn't work :X though the
>> author slides presentation mentioned chmod o+rx on the root dir only.
>>
>> On Sat, Dec 1, 2012 at 6:53 AM, Mike Dewhirst > **> wrote:
>>
>> chmod -R o+rx
>>
>
> Here is my working apache2 conf for project "proj" on site mydomain.com.
> It is running happily on Ubuntu 12.04 with permissions on all /var/www/proj
> directories and files rwxrwx---
>
> This is because I need users in the group to have access but no-one from
> outside. Apache is the owner.
>
> Good luck
>
> Mike
>
> # proj ##**###
>
> 
>
>  # proj resolves to lenny 109
>  DocumentRoot /var/www/proj/htdocs/
>  ServerName proj.mydomain.com
>  ServerAdmin webmas...@mydomain.com
>
>  HostnameLookups Off
>  UseCanonicalName Off
>
>  ErrorLog ${APACHE_LOG_DIR}/proj-error.**log
>  CustomLog ${APACHE_LOG_DIR}/proj-access.**log combined
>
>  Alias /robots.txt /var/www/static/proj/robots/**robots.txt
>  Alias /favicon.ico /var/www/static/proj/img/proj.**ico
>
>  # lock the public out
>  
>   AllowOverride None
>   Order deny,allow
>   Deny from all
>  
>
>  # serve uploaded media from here
>  
>   AllowOverride None
>
>   Order deny,allow
>   Allow from all
>  
>
>  # serve static stuff from here
>  
>   AllowOverride None
>
>   Order deny,allow
>   Allow from all
>  
>
>  
>   Alias /media/ /var/www/media/proj/
>   Alias /static/ /var/www/static/proj/
>   Alias /tiny_mce/ /var/www/static/proj/js/tiny_**mce/
>   Alias /jquery/ /var/www/static/proj/js/**jquery/
>  
>
>  
>WSGIScriptAlias / /var/www/proj/proj/proj.wsgi
>
>
>  Order deny,allow
>  Allow from all
>
>  
>
> 
>
>
>
>
>
>
>
>>
>> --
>> 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+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: django1.5 subclass AbstractUser, How to get a password-(re)set field in admin

2012-11-30 Thread Russell Keith-Magee
Hi Bruce,

Update your Django checkout. This problem was fixed in 0fc5878c.

Yours,
Russ Magee %-)

On Fri, Nov 30, 2012 at 2:07 PM, Detectedstealth wrote:

> Hi Russel,
>
> I have followed
> https://docs.djangoproject.com/en/dev/topics/auth/#a-full-example then
> added:
>
> password = ReadOnlyPasswordHashField(label=_("Password"),
>
> help_text=_("Raw passwords are not stored, so there is no way to
> see "
>
> "this user's password, but you can change the
> password "
>
> "using this form."),
> widget=ReadOnlyPasswordHashWidget())
>
> From what I seen in django/contrib/auth/forms UserChangeForm this gives me
> the change password URL however I get the error: 'CustUser' object has no
> attribute 'username' looking at the error line 136
>
> /Library/Python/2.7/site-packages/django/contrib/auth/admin.py in
> user_change_password
>
>1. 'title': _('Change password: %s') %
>escape(user.username),
>
> It looks like this is either a bug or doesn't work with a custom user as
> planed as it looks for a username even though in the example you set the
> email to username field with: USERNAME_FIELD = 'email'
>
> Am I missing something?
>
> Regards,
> Bruce
>
> On Saturday, November 3, 2012 4:09:09 PM UTC-7, Russell Keith-Magee wrote:
>
>>
>> On Sat, Nov 3, 2012 at 11:15 PM, Michael Muster <
>> michael...@googlemail.com**> wrote:
>>
>>> Hi again,
>>>
>>> I have a subclass from AbstractUser
>>>
>>> 1 from django.contrib.auth.models import AbstractUser
>>> 2 from django.conf import settings
>>> 3
>>> 4 class cpUser(AbstractUser):
>>> 5 twitter = models.CharField(max_length=**100)
>>> 6 def __unicode__(self):
>>> 7 return self.username
>>>
>>> and
>>> AUTH_USER_MODEL = 'account.cpUser'
>>> in my settings.py set.
>>>
>>> How do i get a password field to set and reset
>>> a password in my admin app?
>>> Adding the password field to admin.py does obviously not
>>> work as it enters plain text and not the hashed password.
>>>
>>> 1 from django.contrib import admin
>>> 2 class cpUserAdmin(admin.ModelAdmin):
>>> 3fields = ['twitter','username', 'first_name', 'last_name',
>>> 'password',]
>>> 4
>>> 5 admin.site.register(cpUser, cpUserAdmin)
>>>
>>>
>>> Do i have to set a passwort field to the models.py or
>>> can i geht that from the models which i "abstracted" from
>>> (as done with username, first_name, last_name...)
>>>
>>> You need to follow the instructions that are in the documentation.
>>
>> https://docs.djangoproject.**com/en/dev/topics/auth/#**
>> custom-users-and-django-**contrib-admin
>>
>> The key is that you can't just subclass admin.ModelAdmin -- you need to
>> subclass the existing Django admin class for Users
>> (django.contrib.auth.admin.**UserAdmin) - that base class is what
>> provides all the special password handling etc for User models.
>>
>> Yours,
>> Russ Magee %-)
>>
>  --
> 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/-/sRmpO1m1Ng0J.
> 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: calling the view function in the other view function

2012-11-30 Thread Satinderpal Singh
On Sat, Dec 1, 2012 at 4:45 AM, Chris Cogdon  wrote:
> It's generally very messy for one "view" function to call another.
Then what is the fun of making the function, if it is not reusable.
>
> Better solution is to factorise out the common parts into a third function,
> then make sure each of your two "view" functions have the required
> render_to_response.

What will i do if i have a large number of views having the common part.

> Also, I highly recommend using the "render" shortcut, which would turn your
> more complex calls into this:
Thanks, for the kind advise.
> return render ( request, 'report/report_base.html', {'Head':Head,} )
>
>

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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 apache mod_wsgi permission denied

2012-11-30 Thread Mike Dewhirst

On 1/12/2012 3:57pm, Loai Ghoraba wrote:

thanks, but I have tried this now and it also doesn't work :X though the
author slides presentation mentioned chmod o+rx on the root dir only.

On Sat, Dec 1, 2012 at 6:53 AM, Mike Dewhirst > wrote:

chmod -R o+rx


Here is my working apache2 conf for project "proj" on site mydomain.com. 
It is running happily on Ubuntu 12.04 with permissions on all 
/var/www/proj directories and files rwxrwx---


This is because I need users in the group to have access but no-one from 
outside. Apache is the owner.


Good luck

Mike

# proj #



 # proj resolves to lenny 109
 DocumentRoot /var/www/proj/htdocs/
 ServerName proj.mydomain.com
 ServerAdmin webmas...@mydomain.com

 HostnameLookups Off
 UseCanonicalName Off

 ErrorLog ${APACHE_LOG_DIR}/proj-error.log
 CustomLog ${APACHE_LOG_DIR}/proj-access.log combined

 Alias /robots.txt /var/www/static/proj/robots/robots.txt
 Alias /favicon.ico /var/www/static/proj/img/proj.ico

 # lock the public out
 
  AllowOverride None
  Order deny,allow
  Deny from all
 

 # serve uploaded media from here
 
  AllowOverride None
  Order deny,allow
  Allow from all
 

 # serve static stuff from here
 
  AllowOverride None
  Order deny,allow
  Allow from all
 

 
  Alias /media/ /var/www/media/proj/
  Alias /static/ /var/www/static/proj/
  Alias /tiny_mce/ /var/www/static/proj/js/tiny_mce/
  Alias /jquery/ /var/www/static/proj/js/jquery/
 

 
   WSGIScriptAlias / /var/www/proj/proj/proj.wsgi
   
 Order deny,allow
 Allow from all
   
 










--
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 apache mod_wsgi permission denied

2012-11-30 Thread Mike Dewhirst

On 1/12/2012 3:48pm, Loai Ghoraba wrote:

I have ran chmod o+rx on the root directory, isn't this enough (isn't
chmod applied to all folders down recursively ?) ?


No. You need chmod -R o+rx




and I have checked the directories from the root down to static, all
have the permission of drwxr-xr-x

On Sat, Dec 1, 2012 at 2:21 AM, Chris Cogdon > wrote:

Make sure all the directories, from static leading all the way up to
the root, are chmod a+x


On Friday, November 30, 2012 4:00:55 PM UTC-8, Loai Ghoraba wrote:

Hi

I have installed apache and mod_wsgi and my basic site *skeleton
is running* on local host, but with NO static files loaded such
as css, when I try to access a static file
(e.g:http://localhost/static/__css/base.css
) it says that I don't
have permission to access the file, same goes to media files

I have followed the steps in the presentation slides

http://code.google.com/__p/modwsgi/downloads/detail?__name=mod_wsgi-pycon-sydney-__2010.pdf


 and
made the directories accessible to others via chmod o+rx
, my  httpd.conf part is :

WSGIScriptAlias / /home/loai/workspace/Faculty/__Faculty/wsgi.py
WSGIPythonPath /home/loai/workspace/Faculty

Alias /media/ /home/loai/workspace/Faculty/__Faculty/media
Alias /static/ /home/loai/workspace/Faculty/__Faculty/static


Order deny,allow
Allow from all



Order deny,allow
Allow from all


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/-/L3Sm-aDXA_UJ.

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: Django apache mod_wsgi permission denied

2012-11-30 Thread Loai Ghoraba
I have ran chmod o+rx on the root directory, isn't this enough (isn't chmod
applied to all folders down recursively ?) ?

and I have checked the directories from the root down to static, all have
the permission of drwxr-xr-x

On Sat, Dec 1, 2012 at 2:21 AM, Chris Cogdon  wrote:

> Make sure all the directories, from static leading all the way up to the
> root, are chmod a+x
>
>
> On Friday, November 30, 2012 4:00:55 PM UTC-8, Loai Ghoraba wrote:
>>
>> Hi
>>
>> I have installed apache and mod_wsgi and my basic site *skeleton is
>> running* on local host, but with NO static files loaded such as css, when I
>> try to access a static file 
>> (e.g:http://localhost/static/**css/base.css)
>> it says that I don't have permission to access the file, same goes to media
>> files
>>
>> I have followed the steps in the presentation slides
>> http://code.google.com/**p/modwsgi/downloads/detail?**
>> name=mod_wsgi-pycon-sydney-**2010.pdf
>>  and
>> made the directories accessible to others via chmod o+rx
>> , my  httpd.conf part is :
>>
>> WSGIScriptAlias / /home/loai/workspace/Faculty/**Faculty/wsgi.py
>> WSGIPythonPath /home/loai/workspace/Faculty
>>
>> Alias /media/ /home/loai/workspace/Faculty/**Faculty/media
>> Alias /static/ /home/loai/workspace/Faculty/**Faculty/static
>>
>> 
>> Order deny,allow
>> Allow from all
>> 
>>
>> 
>> Order deny,allow
>> Allow from all
>> 
>>
>> 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/-/L3Sm-aDXA_UJ.
>
> 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.



[Django 1.3] list_display, __unicode__ and sorting

2012-11-30 Thread Micky Hulse
Hello,

Would the below be an OK way to sort __unicode__ in the admin list_display?

Model:

def uni_sort(self):

return self.__unicode__()

uni_sort.admin_order_field = 'sort'
uni_sort.short_description = _(u'name')

Admin:

list_display = ('uni_sort', 'parent', 'name', 'slug',)

...

To save ya'll some time, the docs say:

[[

The __str__() and __unicode__() methods are just as valid in
list_display as any other model method, so it's perfectly OK to do
this:

list_display = ('__unicode__', 'some_other_field')

Usually, elements of list_display that aren't actual database fields
can't be used in sorting (because Django does all the sorting at the
database level).

However, if an element of list_display represents a certain database
field, you can indicate this fact by setting the admin_order_field
attribute of the item.

]]

Unless I'm mistaken, this does not work:

__unicode__.admin_order_field = 'sort'

Otherwise I could just do this:

list_display = ('__unicode__', 'parent', 'name', 'slug',)

My question:

Is it overkill to create a method, that returns the __unicode__ value,
just for the sake of being able to order on the "sort" field?

Thanks!

Cheers,
M

-- 
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 apache mod_wsgi permission denied

2012-11-30 Thread Chris Cogdon
Make sure all the directories, from static leading all the way up to the 
root, are chmod a+x

On Friday, November 30, 2012 4:00:55 PM UTC-8, Loai Ghoraba wrote:
>
> Hi 
>
> I have installed apache and mod_wsgi and my basic site *skeleton is 
> running* on local host, but with NO static files loaded such as css, when I 
> try to access a static file (e.g:http://localhost/static/css/base.css) it 
> says that I don't have permission to access the file, same goes to media 
> files 
>
> I have followed the steps in the presentation slides 
> http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-pycon-sydney-2010.pdf
>  and 
> made the directories accessible to others via chmod o+rx 
> , my  httpd.conf part is :
>
> WSGIScriptAlias / /home/loai/workspace/Faculty/Faculty/wsgi.py
> WSGIPythonPath /home/loai/workspace/Faculty
>
> Alias /media/ /home/loai/workspace/Faculty/Faculty/media
> Alias /static/ /home/loai/workspace/Faculty/Faculty/static
>
> 
> Order deny,allow
> Allow from all
> 
>
> 
> Order deny,allow
> Allow from all
> 
>
> 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/-/L3Sm-aDXA_UJ.
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 apache mod_wsgi permission denied

2012-11-30 Thread Loai Ghoraba
Hi 

I have installed apache and mod_wsgi and my basic site *skeleton is 
running* on local host, but with NO static files loaded such as css, when I 
try to access a static file (e.g:http://localhost/static/css/base.css) it 
says that I don't have permission to access the file, same goes to media 
files 

I have followed the steps in the presentation slides 
http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-pycon-sydney-2010.pdf
 and 
made the directories accessible to others via chmod o+rx 
, my  httpd.conf part is :

WSGIScriptAlias / /home/loai/workspace/Faculty/Faculty/wsgi.py
WSGIPythonPath /home/loai/workspace/Faculty

Alias /media/ /home/loai/workspace/Faculty/Faculty/media
Alias /static/ /home/loai/workspace/Faculty/Faculty/static


Order deny,allow
Allow from all



Order deny,allow
Allow from all


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/-/LG9AgaTxaWAJ.
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: Noobe alert

2012-11-30 Thread Gerald Klein
Hey and thanks for the post, I actually posted this back on saturday and I
figured it out, actually the way you are saying but it wasn't the
permissions. I had to much info, the url going into nginx had two static
 directories next to each other, at first I tried to remove one but I
decided to go with an empty string for STATIC_ROOT and that was it. No
problems now, (basically follow the docs) duhh. But thanks I appreciate the
post.

--jerry

On Fri, Nov 30, 2012 at 5:12 PM, Chris Cogdon  wrote:

> Check the error log for nginx to see if there's any hint of why the
> statics aren't showing up.
>
> My best guess is that the web server is running as a user that does not
> have access to the files, and the error log should be showing up with
> various "permission denied" messages.
>
> The usual culprit is that while the static directory and files are
> readable by everyone, the parent directories do not have the "execute"
> permission bit set. On a directory "execute" means the ability to trasverse
> the directory and get access to the contents, but not get a directory
> listing.
>
> To fix, try something like this:
>
> chmod a+x /var /var/www /var/www/virtualenv-test
> /var/www/virtualenv-test/ENV /var/www/virtualenv-test/ENV/**
> testsite /var/www/virtualenv-test/ENV/**testsite/static
>
>
>
> On Saturday, November 17, 2012 11:28:01 AM UTC-8, Gerald Klein wrote:
>>
>> Hi, I finally got a project in Django and I have a "what I hope is an
>> easy question" I started to set up a production server and yes the admin
>> css dissappeared, I went though the docs and followed them. I used the
>> Collect Static Files method and still no joy. Here is my info:
>>
>> #settings.py
>> MEDIA_ROOT = '/var/www/virtualenv-test/ENV/**testsite/media/'
>> MEDIA_URL = 'http://localhost/media/'
>> STATIC_ROOT = '/var/www/virtualenv-test/ENV/**testsite/static/'
>> STATIC_URL = 'http://localhost/static/'
>>
>> #niginx
>>
>>
>> root /var/www/virtualenv-test/ENV/**testsite;
>>
>> location /media/ {
>> root /var/www/virtualenv-test/ENV/**testsite/media;
>> }
>>
>> location /static/ {
>> root /var/www/virtualenv-test/ENV/**testsite/static;
>> }
>>
>> My project is located in /var/www/virtualenv-test/ENV/
>>
>> the project is testsite so the hierarchy inside ENV is:
>>
>> testsite/
>> media/
>> static/all files from collect static files
>> testsite/
>> __init__.py
>> settings.py
>> urls.py
>> wsgi.py
>> manage.py
>>
>> I am using version (1, 4, 2, 'final', 0).
>>
>> If somebody can point out the probably obvious problem that I am missing
>> I would greatly appreciate it.
>>
>> thanks in advance for your help
>>
>> --jerry
>>
>> --
>>
>> j...@zognet.com
>>
>> 708-599-0352
>>
>>
>> Arch Awesome, Ranger & Vim the coding triple threat.
>>
>> Linux registered user #548580
>>
>>
>>
>>   --
> 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/-/kmAdUKxb57UJ.
> 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.
>



-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

geraldklein.wordpress.com

j...@zognet.com

708-599-0352


Arch Awesome, Ranger & Vim the coding triple threat.

Linux registered user #548580

-- 
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 use named urls from apps

2012-11-30 Thread Chris Cogdon
And, don't forget, the form is:

{% load url from future %}
{% url 'auth_login' %}

OR

{% url auth_login %}

The former is highly recommend, as the latter is deprecated and will become 
the default in a future Django release.

If you ever get messages such as "view not found for reverse"... this has 
been my culprit 90% of the time.

-- 
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/-/Gxsauy6BCOIJ.
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: admin foreign key issues

2012-11-30 Thread Chris Cogdon



> class CategoryAdmin(admin.ModelAdmin): 
> list_display = ('name') 
> list_filter = ('name') 
> admin.site.register(Category, CategoryAdmin) 
>
> But that fails with 'CategoryAdmin.list_display' must be a list or tuple. 
>

use:   list_display = ('name',)

Note the trailing comma, there?

In python, a tuple with a single element must use the form ( x, )  or it is 
indistinguishable from a parenthesised expression. 
 

>
>

-- 
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/-/eXAQLOj3egYJ.
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: calling the view function in the other view function

2012-11-30 Thread Chris Cogdon
It's generally very messy for one "view" function to call another.

Better solution is to factorise out the common parts into a third function, 
then make sure each of your two "view" functions have the required 
render_to_response.

Also, I highly recommend using the "render" shortcut, which would turn your 
more complex calls into this:

return render ( request, 'report/report_base.html', {'Head':Head,} )


On Thursday, November 29, 2012 10:31:03 PM UTC-8, Satinderpal Singh wrote:
>
> I have to call a function into another function which displays the 
> values from the database to the browser, like this: 
>
> def result(request): 
> zee = head.objects.aggregate(Max('id')) 
> mee = zee['id__max'] 
> Head = head.objects.filter(id = mee) 
> return render_to_response('report/report_base.html', 
> {'Head':Head,},context_instance=RequestContext(request)) 
>
> def result_cube(request): 
> Head = result(mee) 
> organisation = Organisation.objects.all().filter(id = 1) 
> return render_to_response('report/cube.html', { 'Head':Head, 
> 'organisation':organisation},context_instance=RequestContext(request)) 
>
> I want to call "result" view in the "result_cube",  as it displays the 
> html data but not showing the data from the database. 
>
> -- 
> Satinderpal Singh 
> http://satindergoraya.blogspot.in/ 
> http://satindergoraya91.blogspot.in/ 
>

-- 
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/-/sv67A78gud4J.
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: Noobe alert

2012-11-30 Thread Chris Cogdon
Check the error log for nginx to see if there's any hint of why the statics 
aren't showing up.

My best guess is that the web server is running as a user that does not 
have access to the files, and the error log should be showing up with 
various "permission denied" messages.

The usual culprit is that while the static directory and files are readable 
by everyone, the parent directories do not have the "execute" permission 
bit set. On a directory "execute" means the ability to trasverse the 
directory and get access to the contents, but not get a directory listing.

To fix, try something like this:

chmod a+x /var /var/www /var/www/virtualenv-test 
/var/www/virtualenv-test/ENV /var/www/virtualenv-test/ENV/testsite 
/var/www/virtualenv-test/ENV/testsite/static



On Saturday, November 17, 2012 11:28:01 AM UTC-8, Gerald Klein wrote:
>
> Hi, I finally got a project in Django and I have a "what I hope is an easy 
> question" I started to set up a production server and yes the admin css 
> dissappeared, I went though the docs and followed them. I used the Collect 
> Static Files method and still no joy. Here is my info: 
>
> #settings.py
> MEDIA_ROOT = '/var/www/virtualenv-test/ENV/testsite/media/'
> MEDIA_URL = 'http://localhost/media/'
> STATIC_ROOT = '/var/www/virtualenv-test/ENV/testsite/static/'
> STATIC_URL = 'http://localhost/static/'
>
> #niginx
>
>
> root /var/www/virtualenv-test/ENV/testsite;
>
> location /media/ {
> root /var/www/virtualenv-test/ENV/testsite/media;
> }
>
> location /static/ {
> root /var/www/virtualenv-test/ENV/testsite/static;
> }
>
> My project is located in /var/www/virtualenv-test/ENV/
>
> the project is testsite so the hierarchy inside ENV is:
>
> testsite/
> media/
> static/all files from collect static files
> testsite/
> __init__.py
> settings.py
> urls.py
> wsgi.py
> manage.py
>
> I am using version (1, 4, 2, 'final', 0). 
>
> If somebody can point out the probably obvious problem that I am missing I 
> would greatly appreciate it. 
>
> thanks in advance for your help
>
> --jerry
>
> -- 
>
> j...@zognet.com 
>
> 708-599-0352
>
>
> Arch Awesome, Ranger & Vim the coding triple threat.
>
> Linux registered user #548580 
>
>
>
>  

-- 
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/-/kmAdUKxb57UJ.
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: Thumbnail resizing issue, strange behavior

2012-11-30 Thread Tom Evans
On Fri, Nov 30, 2012 at 6:45 PM, Mo J. Al-Mughrabi
 wrote:
> Hi,
>
> I've been trying to resolve this issue for a day without luck, its
> very strange error, i tried to post it on stackoverflow but still no
> luck.
>
>
> http://stackoverflow.com/questions/13629099/getting-cannot-identify-image-file-when-trying-to-create-thumbnail-in-django
>

Does it still crash if you fix the double commit?

instance = super(ImageForm, self).save(commit=False)

You shouldn't save it at all if commit=False was passed, and only save
it once if commit=True was passed.

Seeing the traceback may be informative too - sanitize it if needs be.

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.



Thumbnail resizing issue, strange behavior

2012-11-30 Thread Mo J. Al-Mughrabi
Hi,

I've been trying to resolve this issue for a day without luck, its
very strange error, i tried to post it on stackoverflow but still no
luck.


http://stackoverflow.com/questions/13629099/getting-cannot-identify-image-file-when-trying-to-create-thumbnail-in-django

-- 
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: Drop foreign key, add another - keep data

2012-11-30 Thread Tom Evans
On Fri, Nov 30, 2012 at 11:56 AM, Peter Edström  wrote:
> Hello,
>
> I'd like to drop a ForeignKey-field and add another using south (mysql
> database), but it won't work. Googling it takes me not far, but it seems to
> be a problem with dropping foreign key constraints with InnoDB.
> What is the recommended way ot dropping a ForeignKey-field, and adding
> another?
>
> Say the model looks like this:
>
>> class Model1(models.Model):
>>
>> test = models.ForeignKey(Model2)
>
>
> And I won't to change it to:
>
>> class Model1(models.Model):
>>
>> test2 = models.ForeignKey(Model3)
>
>
> Right now I don't really care if I lose data, but for future reference I'd
> prefer a method that keeps it.
>
> Thank you.
>

How are you trying to do it? There should be several migrations:

1) A schema migration to add the new foreign key, which should be
nullable at this point
2) A data migration to move the old data into the new column
3) A schema migration to drop the nullability of the new foreign key
4) A schema migration to drop the old foreign key

You may not need as many migrations if you do not need to migrate the
old data over, or if the new foreign key is allowed to be null.

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.



Drop foreign key, add another - keep data

2012-11-30 Thread Peter Edström
Hello,

I'd like to drop a ForeignKey-field and add another using south (mysql 
database), but it won't work. Googling it takes me not far, but it seems to 
be a problem with dropping foreign key constraints with InnoDB.
What is the recommended way ot dropping a ForeignKey-field, and adding 
another?

Say the model looks like this:

class Model1(models.Model):

test = models.ForeignKey(Model2) 


And I won't to change it to:

class Model1(models.Model):

test2 = models.ForeignKey(Model3) 

 
Right now I don't really care if I lose data, but for future reference I'd 
prefer a method that keeps it.

Thank you.

-- 
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/-/1XoEfk3TBlQJ.
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.