feature request - iunique

2010-06-20 Thread Kenneth Gonsalves
hi,

request: we have:
name = CharField("Name",iunique=True)
iunique translates into a case insensitive unique

reason: Most languages in the planet do not have case. This is peculiar to 
languages using the roman script. As a result, data entry done by people from 
non roman script backgrounds generally tends to ignore case. It is fairly 
trivial to write a line or two of code to handle this, but in view of the 
widespread prevalence of the problem iunique on a charfield would be a welcome 
feature. 
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: A Django project life cycle

2010-06-20 Thread Kenneth Gonsalves
On Saturday 19 June 2010 19:21:10 Sameer Rahmani wrote:
> >> http://www.catb.org/~esr/faqs/smart-questions.html
> >> http://www.djangobook.com/
> 
> just for more information , i read django book , i know what i want ,
> and if you don't want to help please don't send me those link.
> 
> > Can anyone give OP a useful answer?
> 
> what do you mean by OP
> 

Original Poster
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: A Django project life cycle

2010-06-20 Thread Sam Lai
The onion model on the Django middleware documentation page might also help -

http://docs.djangoproject.com/en/dev/topics/http/middleware/

The rest of it (how it is handled from the WSGI handler etc.) is
really an internal matter. Unless you want to contribute to Django or
create some custom version of it, there isn't much need/point in
fiddling with it, because you'll just be asking for pain when there
are updates. There should be enough extensibility points for you
already.

On 20 June 2010 14:47, Kenneth Gonsalves  wrote:
> On Saturday 19 June 2010 18:04:33 Sameer Rahmani wrote:
>> i want to know about a django project life cycle, can any body help me
>>  please?
>>
>> i want to know how a django project run under wsgi and development server ?
>> which files runs first?
>> does a project run in each request? or it remain in memory ?
>> and any other useful information
>>
>
> well first thing is that django is a framework and not a server. So basically
> the flow is precisely the same as ordinary cgi programming. You type in a url
> which calls a function which does something and displays a page.
> --
> Regards
> Kenneth Gonsalves
> Senior Associate
> NRC-FOSS at AU-KBC
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Serving media files

2010-06-20 Thread Jagdeep Singh Malhi


On Jun 19, 10:36 pm, Justin Myers  wrote:
> Have you set your MEDIA_ROOT, MEDIA_URL and ADMIN_MEDIA_PREFIX
> settings in settings.py?
>
setting is :-
MEDIA_ROOT = '/home/your_name/mysite/media/'


MEDIA_URL = 'http://localhost/media'


ADMIN_MEDIA_PREFIX = '/media/'

> On Jun 19, 12:06 pm, Jagdeep Singh Malhi 
> wrote:
>
> > now my httpd.conf   file is :-
>
> > Alias /media/ /usr/local/lib/python2.6/dist-packages/django/contrib/
> > admin/media/
>
> >  > media/>
> > Order deny,allow
> > Allow from all
> > 
>
> > WSGIScriptAlias / /home/jagdeep/mysite/apache/django.wsgi
>
> > 
> > Order allow,deny
> > Allow from all
> > 
>
> > but myhttp://localhost/admin/is not show in graphic format or not
> > use css files
>
> > its again show in this format
>
> > MY admin page (http://localhost/admin/)
>
> >  Django administration
> >  Welcome, Jagdeep. Change password / Log out
> >  Site administration
> >    Auth
> >  Groups  Add     Change
> >  Users   Add     Change
> >     Polls
> >  Polls   Add     Change
> >     Sites
> >  Sites   Add     Change
>
> >  Recent Actions
> >  My Actions
>
> > but  i can do sir ???

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: UnicodeDecodeError (ordinal not in range) when deleting an inline item - 1.2.1

2010-06-20 Thread Federico Capoano
I logged onto the server via SSH and tried the command "locale", the
following is what I get:

LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Any hint?



On Jun 19, 5:25 pm, Federico Capoano  wrote:
> The same code on my computer offline works without problems, so I
> guess It's a server configuration problem, what do you think?
>
> I read the this bit 
> here:http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#if-y...
>
> And it says to write something similar to:
>
> export LANG='en_US.UTF-8'
> export LC_ALL='en_US.UTF-8'
>
> But where? I've looked around the net but I can't understand how do I
> set this environment variables? The server I'm talking about is a Red
> Hat Linux Enterprise.
>
> I can't fix this problem. I hope my client doesn't get pissed off at
> me :-S
>
> On Jun 15, 9:47 am, Matt Hoskins  wrote:
>
> > >   File "/usr/lib/python2.3/site-packages/sorl/thumbnail/utils.py",
> > > line 36, in all_thumbnails
> > >     if os.path.isfile(os.path.join(path, file)):
>
> > >   File "/usr/local/lib/python2.6/posixpath.py", line 68, in join
> > >     path +=  b
>
> > > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> > > 13: ordinal not in range(128)
>
> > What this error means is that either path or b is a normal (non-
> > unicode) string and contains a non-ascii character (perhaps the
> > character Ã) at position 13 and the other one is a unicode string.
> > When python concatenates a non-unicode string and a unicode string it
> > tries to convert the non-unicode string to unicode using the ascii
> > encoding.
>
> > As to which is which... well I've had a brief glance at the sorl code
> > and it'll take more time than I can be bothered to spend to figure out
> > which :). My guess is that the filename coming from Django is coming
> > in as a unicode string, although sorl has a number of normal string
> > literals in it I suspect that's making it through as unicode... So
> > that perhaps leaves your sorl path configurations - perhaps you're not
> > configuring the directory paths for sorl using unicode strings and
> > that's causing the problem.
>
> > Matt

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Serving media files

2010-06-20 Thread Jagdeep Singh Malhi
in  which  file  i see  these lines .

 

wrote:
> On Jun 20, 3:06 am, Jagdeep Singh Malhi 
> wrote:
>
> > now my httpd.conf   file is :-
>
> > Alias /media/ /usr/local/lib/python2.6/dist-packages/django/contrib/
> > admin/media/
>
> >  > media/>
> > Order deny,allow
> > Allow from all
> > 
>
> Change this to:
>
>    admin/media/>
>   Options Indexes
>   Order deny,allow
>   Allow from all
>   
>
> Then access the URL:
>
>   /media/
>
> on your web server via the browser. You should get a response
> something like:
>
> Index of /media
>
>         Name    Last modified   Size    Description
>         Parent Directory                 -
>         css/    09-Jun-2010 11:46        -
>         img/    09-Jun-2010 11:46        -
>         js/     09-Jun-2010 11:46        -
>
> If you aren't, then that isn't where the media files are or directory
> is not accessible to Apache user for some reason.
>
> Then view the source of the response when access Django admin page.
> You should see something like:
>
>   
>   
>
>
> If you don't see the href link starting with '/media', then you have
> fiddled the default settings in your Django settings.py to something
> incompatible. The defaults are:
>
>   MEDIA_ROOT = ''
>   MEDIA_URL = ''
>   ADMIN_MEDIA_PREFIX = '/media/'
>
> And if left untouched everything should work where media mounted at /
> media in Apache.
>
> Graham
>
> > WSGIScriptAlias / /home/jagdeep/mysite/apache/django.wsgi
>
> > 
> > Order allow,deny
> > Allow from all
> > 
>
> > but myhttp://localhost/admin/is not show in graphic format or not
> > use css files
>
> > its again show in this format
>
> > MY admin page (http://localhost/admin/)
>
> >  Django administration
> >  Welcome, Jagdeep. Change password / Log out
> >  Site administration
> >    Auth
> >  Groups  Add     Change
> >  Users   Add     Change
> >     Polls
> >  Polls   Add     Change
> >     Sites
> >  Sites   Add     Change
>
> >  Recent Actions
> >  My Actions
>
> > but  i can do sir ???

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Serving media files

2010-06-20 Thread Jagdeep Singh Malhi
Is these  setting of my  setting.py  files are  correct ?

setting is :-
MEDIA_ROOT = '/home/your_name/mysite/media/'

MEDIA_URL = 'http://localhost/media'

ADMIN_MEDIA_PREFIX = '/media/'

On Jun 20, 2:08 pm, Jagdeep Singh Malhi 
wrote:
> On Jun 19, 10:36 pm, Justin Myers  wrote:> Have you set 
> your MEDIA_ROOT, MEDIA_URL and ADMIN_MEDIA_PREFIX
> > settings in settings.py?
>
> setting is :-
> MEDIA_ROOT = '/home/your_name/mysite/media/'
>
> MEDIA_URL = 'http://localhost/media'
>
> ADMIN_MEDIA_PREFIX = '/media/'
>
> > On Jun 19, 12:06 pm, Jagdeep Singh Malhi 
> > wrote:
>
> > > now my httpd.conf   file is :-
>
> > > Alias /media/ /usr/local/lib/python2.6/dist-packages/django/contrib/
> > > admin/media/
>
> > >  > > media/>
> > > Order deny,allow
> > > Allow from all
> > > 
>
> > > WSGIScriptAlias / /home/jagdeep/mysite/apache/django.wsgi
>
> > > 
> > > Order allow,deny
> > > Allow from all
> > > 
>
> > > but myhttp://localhost/admin/is not show in graphic format or not
> > > use css files
>
> > > its again show in this format
>
> > > MY admin page (http://localhost/admin/)
>
> > >  Django administration
> > >  Welcome, Jagdeep. Change password / Log out
> > >  Site administration
> > >    Auth
> > >  Groups  Add     Change
> > >  Users   Add     Change
> > >     Polls
> > >  Polls   Add     Change
> > >     Sites
> > >  Sites   Add     Change
>
> > >  Recent Actions
> > >  My Actions
>
> > > but  i can do sir ???

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: A Django project life cycle

2010-06-20 Thread Sameer Rahmani
thanks for your consideration ,  i know that this is a painful matter
and need extra work
but i need to understand this cycle to write some peace of code for my
project that optimize
some actions also i really love to contribute to django, so please guide me :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Serving media files

2010-06-20 Thread Graham Dumpleton


On Jun 20, 7:34 pm, Jagdeep Singh Malhi 
wrote:
> in  which  file  i see  these lines .
>
>  
>  On Jun 20, 5:25 am, Graham Dumpleton 
> wrote:
>
>
>
> > On Jun 20, 3:06 am, Jagdeep Singh Malhi 
> > wrote:
>
> > > now my httpd.conf   file is :-
>
> > > Alias /media/ /usr/local/lib/python2.6/dist-packages/django/contrib/
> > > admin/media/
>
> > >  > > media/>
> > > Order deny,allow
> > > Allow from all
> > > 
>
> > Change this to:
>
> >    > admin/media/>
> >   Options Indexes
> >   Order deny,allow
> >   Allow from all
> >   
>
> > Then access the URL:
>
> >   /media/
>
> > on your web server via the browser. You should get a response
> > something like:
>
> > Index of /media
>
> >         Name    Last modified   Size    Description
> >         Parent Directory                 -
> >         css/    09-Jun-2010 11:46        -
> >         img/    09-Jun-2010 11:46        -
> >         js/     09-Jun-2010 11:46        -
>
> > If you aren't, then that isn't where the media files are or directory
> > is not accessible to Apache user for some reason.
>
> > Then view the source of the response when access Django admin page.
> > You should see something like:
>
> >   
> >   
> > If you don't see the href link starting with '/media', then you have
> > fiddled the default settings in your Django settings.py to something
> > incompatible. The defaults are:
>
> >   MEDIA_ROOT = ''
> >   MEDIA_URL = ''
> >   ADMIN_MEDIA_PREFIX = '/media/'
>
> > And if left untouched everything should work where media mounted at /
> > media in Apache.
>
> > Graham
>
> > > WSGIScriptAlias / /home/jagdeep/mysite/apache/django.wsgi
>
> > > 
> > > Order allow,deny
> > > Allow from all
> > > 
>
> > > but myhttp://localhost/admin/is not show in graphic format or not
> > > use css files
>
> > > its again show in this format
>
> > > MY admin page (http://localhost/admin/)
>
> > >  Django administration
> > >  Welcome, Jagdeep. Change password / Log out
> > >  Site administration
> > >    Auth
> > >  Groups  Add     Change
> > >  Users   Add     Change
> > >     Polls
> > >  Polls   Add     Change
> > >     Sites
> > >  Sites   Add     Change
>
> > >  Recent Actions
> > >  My Actions
>
> > > but  i can do sir ???

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: A Django project life cycle

2010-06-20 Thread Sam Lai
I can't really help you because I don't know the internal life cycle
either. I'd just start with reading through the code, which isn't
really that hard (and it is what I've been doing for my custom admin
form behaviour).

If you have specific questions, you could post it here (or if it looks
like you need to extend something that Django doesn't currently allow,
maybe try the django-dev list).

The members here might be able to offer better solutions if you let us
know what you are trying to optimise, because someone here might have
experienced the problem before (and done the digging that you're
after).

Also, I'm sure you've heard all the bad things that are said about
premature optimisation. Write your code first according to Django
conventions, then optimise.

On 20 June 2010 19:56, Sameer Rahmani  wrote:
> thanks for your consideration ,  i know that this is a painful matter
> and need extra work
> but i need to understand this cycle to write some peace of code for my
> project that optimize
> some actions also i really love to contribute to django, so please guide me :)
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Serving media files

2010-06-20 Thread Jagdeep Singh Malhi


On Jun 20, 3:08 pm, Graham Dumpleton 
wrote:
> On Jun 20, 7:34 pm, Jagdeep Singh Malhi 
> wrote:
>
> > in  which  file  i see  these lines .
>
> >  
> > 
> In your browser, when you request the admin page which isn't showing
> the styling, use your browser to view the source code for that page as
> the browser received it. This may be under view menu or you can right
> click on page to get context menu and it will show option for viewing
> source code.
>
> Did you validate that the /media/ URL shows those directories?
>

/media is not show those directories
its display  the   files  of  my operating systems files under media
directriy me using  ubuntu 10.04
> Did you set those values in settings file back to their default?

setting is :-
MEDIA_ROOT = '/home/your_name/mysite/media/'

MEDIA_URL = 'http://localhost/media'

ADMIN_MEDIA_PREFIX = '/media/'

is this correct or not ???
>
> Graham
>
> > On Jun 20, 5:25 am, Graham Dumpleton 
> > wrote:
>
> > > On Jun 20, 3:06 am, Jagdeep Singh Malhi 
> > > wrote:
>
> > > > now my httpd.conf   file is :-
>
> > > > Alias /media/ /usr/local/lib/python2.6/dist-packages/django/contrib/
> > > > admin/media/
>
> > > >  > > > media/>
> > > > Order deny,allow
> > > > Allow from all
> > > > 
>
> > > Change this to:
>
> > >    > > admin/media/>
> > >   Options Indexes
> > >   Order deny,allow
> > >   Allow from all
> > >   
>
> > > Then access the URL:
>
> > >   /media/
>
> > > on your web server via the browser. You should get a response
> > > something like:
>
> > > Index of /media
>
> > >         Name    Last modified   Size    Description
> > >         Parent Directory                 -
> > >         css/    09-Jun-2010 11:46        -
> > >         img/    09-Jun-2010 11:46        -
> > >         js/     09-Jun-2010 11:46        -
>
> > > If you aren't, then that isn't where the media files are or directory
> > > is not accessible to Apache user for some reason.
>
> > > Then view the source of the response when access Django admin page.
> > > You should see something like:
>
> > >   
> > >   
> > > If you don't see the href link starting with '/media', then you have
> > > fiddled the default settings in your Django settings.py to something
> > > incompatible. The defaults are:
>
> > >   MEDIA_ROOT = ''
> > >   MEDIA_URL = ''
> > >   ADMIN_MEDIA_PREFIX = '/media/'
>
> > > And if left untouched everything should work where media mounted at /
> > > media in Apache.
>
> > > Graham
>
> > > > WSGIScriptAlias / /home/jagdeep/mysite/apache/django.wsgi
>
> > > > 
> > > > Order allow,deny
> > > > Allow from all
> > > > 
>
> > > > but myhttp://localhost/admin/is not show in graphic format or not
> > > > use css files
>
> > > > its again show in this format
>
> > > > MY admin page (http://localhost/admin/)
>
> > > >  Django administration
> > > >  Welcome, Jagdeep. Change password / Log out
> > > >  Site administration
> > > >    Auth
> > > >  Groups  Add     Change
> > > >  Users   Add     Change
> > > >     Polls
> > > >  Polls   Add     Change
> > > >     Sites
> > > >  Sites   Add     Change
>
> > > >  Recent Actions
> > > >  My Actions
>
> > > > but  i can do sir ???

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: A Django project life cycle

2010-06-20 Thread Sameer Rahmani
i want to run a peace of code in the beginning of life cycle ( may be
in settings.py ) but i want to know about
number process and the codes that remain on memory ? olso i want to
run a peace of code in the ending part

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Serving media files

2010-06-20 Thread Graham Dumpleton


On Jun 20, 9:17 pm, Jagdeep Singh Malhi 
wrote:
> On Jun 20, 3:08 pm, Graham Dumpleton 
> wrote:
>
> > On Jun 20, 7:34 pm, Jagdeep Singh Malhi 
> > wrote:
>
> > > in  which  file  i see  these lines .
>
> > >  
> > > 
> yes  these links are  shown in source file
>
>
>
> > In your browser, when you request the admin page which isn't showing
> > the styling, use your browser to view the source code for that page as
> > the browser received it. This may be under view menu or you can right
> > click on page to get context menu and it will show option for viewing
> > source code.
>
> > Did you validate that the /media/ URL shows those directories?
>
> /media is not show those directories
> its display  the   files  of  my operating systems files under media
> directriy me using  ubuntu 10.04

What do you mean by that? Post what the browser shows when you access:

  /media/

on your site from your browser. Eg. access:

  http://localhost/media/

if access it via localhost.

Note that the trailing slash is important.

There is no point just saying that it doesn't show what I suggest
should be seen, post what it does show instead.

Also post the output of running:

  ls -las /usr/local/lib/python2.6/dist-packages/django/contrib/admin/
media/

Please supply these bits of information, otherwise it is just getting
too hard to help you. May as well consult a tarot reader if you aren't
going to provide what is asked or offer up any other information which
may be relevant to working out what you have done wrong.

> > Did you set those values in settings file back to their default?
>
> setting is :-
> MEDIA_ROOT = '/home/your_name/mysite/media/'
>
> MEDIA_URL = 'http://localhost/media'
>
> ADMIN_MEDIA_PREFIX = '/media/'
>
> is this correct or not ???

As I pointed out before, the defaults should work without you having
changed them. What you have there isn't the defaults I get in settings
file when I generate a fresh Django site so you must have changed
them.

Set them back to what I said in other email for now. Ie.,

  MEDIA_ROOT = ''
  MEDIA_URL = ''
  ADMIN_MEDIA_PREFIX = '/media/'

Graham

>
>
>
>
> > Graham
>
> > > On Jun 20, 5:25 am, Graham Dumpleton 
> > > wrote:
>
> > > > On Jun 20, 3:06 am, Jagdeep Singh Malhi 
> > > > wrote:
>
> > > > > now my httpd.conf   file is :-
>
> > > > > Alias /media/ /usr/local/lib/python2.6/dist-packages/django/contrib/
> > > > > admin/media/
>
> > > > >  > > > > /usr/local/lib/python2.6/dist-packages/django/contrib/admin/
> > > > > media/>
> > > > > Order deny,allow
> > > > > Allow from all
> > > > > 
>
> > > > Change this to:
>
> > > >    > > > admin/media/>
> > > >   Options Indexes
> > > >   Order deny,allow
> > > >   Allow from all
> > > >   
>
> > > > Then access the URL:
>
> > > >   /media/
>
> > > > on your web server via the browser. You should get a response
> > > > something like:
>
> > > > Index of /media
>
> > > >         Name    Last modified   Size    Description
> > > >         Parent Directory                 -
> > > >         css/    09-Jun-2010 11:46        -
> > > >         img/    09-Jun-2010 11:46        -
> > > >         js/     09-Jun-2010 11:46        -
>
> > > > If you aren't, then that isn't where the media files are or directory
> > > > is not accessible to Apache user for some reason.
>
> > > > Then view the source of the response when access Django admin page.
> > > > You should see something like:
>
> > > >   
> > > >   
> > > > If you don't see the href link starting with '/media', then you have
> > > > fiddled the default settings in your Django settings.py to something
> > > > incompatible. The defaults are:
>
> > > >   MEDIA_ROOT = ''
> > > >   MEDIA_URL = ''
> > > >   ADMIN_MEDIA_PREFIX = '/media/'
>
> > > > And if left untouched everything should work where media mounted at /
> > > > media in Apache.
>
> > > > Graham
>
> > > > > WSGIScriptAlias / /home/jagdeep/mysite/apache/django.wsgi
>
> > > > > 
> > > > > Order allow,deny
> > > > > Allow from all
> > > > > 
>
> > > > > but myhttp://localhost/admin/is not show in graphic format or not
> > > > > use css files
>
> > > > > its again show in this format
>
> > > > > MY admin page (http://localhost/admin/)
>
> > > > >  Django administration
> > > > >  Welcome, Jagdeep. Change password / Log out
> > > > >  Site administration
> > > > >    Auth
> > > > >  Groups  Add     Change
> > > > >  Users   Add     Change
> > > > >     Polls
> > > > >  Polls   Add     Change
> > > > >     Sites
> > > > >  Sites   Add     Change
>
> > > > >  Recent Actions
> > > > >  My Actions
>
> > > > > but  i can do sir ???

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: A Django project life cycle

2010-06-20 Thread Sam Lai
If you want to run a piece of code on receiving a view HTTP request,
and a piece of code just before the response is sent to the user, look
into Django middleware
(http://docs.djangoproject.com/en/dev/topics/http/middleware/). That
is what it is specifically designed to do.

If instead you want to run a piece of code when Django starts up, and
when it is killed, that would depend on how you are serving the page.
Are you using Apache? With mod_python, or mod_wsgi?

If you're using mod_wsgi (which you should), the mod_wsgi docs are
quite useful, e.g.
http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

Also, Django's signals functionality might be help too if middleware
is not - http://docs.djangoproject.com/en/dev/ref/signals/#ref-signals

On 20 June 2010 21:24, Sameer Rahmani  wrote:
> i want to run a peace of code in the beginning of life cycle ( may be
> in settings.py ) but i want to know about
> number process and the codes that remain on memory ? olso i want to
> run a peace of code in the ending part
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: A Django project life cycle

2010-06-20 Thread Sameer Rahmani
h , i use wsgi and django development server,
i was thinking about signals too, and thanks for docs i'll read them

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



decoupling project name from import?

2010-06-20 Thread vcarney
I created a new project with django-admin.py as such:

django-admin.py startproject foo

Under the folder foo it gives me the basic files:
__init__.py
manage.py
settings.py
urls.py

I then created a new folder under foo named apps and added a blank
__init__.py. Within the apps folder I created a new app with django-
admin.py instead of manage.py:

django-admin.py startapp bar

This gives me the basic files within bar like models.py. I also
created a new managers.py file within this same bar directory:

__init__.py
managers.py
models.py
tests.py
views.py

In my foo/bar/models.py file, I need to import a class from
managers.py. I have tried "from bar.managers import PublicManger"
which gives me an ImportError stating no module is named bar.managers.
However, when I import with "from foo.apps.bar.managers" it works.

How do I decouple the project name within my apps so I may distribute
the source code?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: UnicodeDecodeError (ordinal not in range) when deleting an inline item - 1.2.1

2010-06-20 Thread Karen Tracey
On Sun, Jun 20, 2010 at 5:15 AM, Federico Capoano
wrote:

> I logged onto the server via SSH and tried the command "locale", the
> following is what I get:
>
> LANG=en_US.UTF-8
>
[snipped remainder]

That looks fine, but the locale when you ssh into the server is not
necessarily the same as the locale configured for the web server. For some
reason it seems that it is popular to configure Apache (are you using
Apache?) to run with LANG=C, which causes Python to think that the
"preferred" file system encoding is ASCII, which breaks any attempt to use
files with non-ASCII characters in their names. The doc I pointed to ends
with:

Consult the documentation for your operating system for the appropriate
syntax and location to put these configuration items; /etc/apache2/envvars
is a common location on Unix platforms. Once you have added these statements
to your environment, restart Apache.

I am not familiar with Red Hat so I can't give you any more specific advice
than that. If it does not use /etc/apache2/envvars (or if you are using some
server other than Apache), then you need to consult the Red Hat doc or
forums to find out how to configure your web server to run with a LANG other
than C or whatever it is currently using.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Chase Paymentech

2010-06-20 Thread Dan Gentry
Storing credit card numbers (and other info) isn't the only concern of
the PCI standards. If your form collects a number an passes it on to
the processor, you could also be vulnerable.

On Jun 18, 2:09 pm, surtyaar  wrote:
> Hi Bobby,
>
> You might be interested in a django clone of the sample shopping cart
> chase paymentech provided (http://store.e-xact.com/).
>
> You can get the code and setup instructions here 
> :http://github.com/gitaaron/E-xact-django-clone
>
> Rgds/
> Aaron
>
> On Apr 20, 10:34 am, Bobby Roberts  wrote:
>
>
>
> > Hey Bill -
>
> > It is my understanding that as long as you do not store credit card
> > information on your servers, PCI compliance is not an issue.  Chase,
> > Authorize.net, Paypal, ilovechecks.com etc all have API gateways to
> > handle the transactions via https protocol which satisfies the
> > industry financial standards.  I'm just wondering if anyone has infact
> > worked with the Chase API before
>
> > On Apr 20, 10:17 am, Bill Freeman  wrote:
>
> > > Beware!  There are a number of security vulnerabilities you can have when
> > > handling credit card numbers.  There is something called PCI (Payment Card
> > > Industry, if I'm not mistaken) compliance, the intent of which is to
> > > try to avoid
> > > some of the big credit card number stealing hacks that have been in the 
> > > news
> > > in recent years.
>
> > > For most sites it is better to deal with someone like Authorize.net:  
> > > These
> > > services let you point your "checkout" link at them, either with a back 
> > > channel
> > > identified by order number (which you add to the url) to pick up the 
> > > total, and
> > > perhaps the item list, or a way to provide that in the get or post
> > > with a suitable
> > > signature.  They host a page that you get to style, so you can have,
> > > for example,
> > > your color scheme and logo.  They accept the credit card information, do 
> > > the
> > > dance with the payment processor (such as Chase Paymentech), and, if
> > > payment is successful, send you a packet, email, or provide a webservice
> > > where you can check, so that you know to "ship".  These services do all 
> > > the
> > > PCI compliance diligence.  You are safe because the credit card 
> > > information
> > > never touches your website.
>
> > > On Mon, Apr 19, 2010 at 10:17 AM, Bobby Roberts  
> > > wrote:
> > > > Has anyone out there integrated a payment module in django over to
> > > > Chase Paymentech to process credit cards?  I'm looking for sample code.
>
> > > > --
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "Django users" group.
> > > > To post to this group, send email to django-us...@googlegroups.com.
> > > > To unsubscribe from this group, send email to 
> > > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group 
> > > > athttp://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-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://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-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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-us...@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.



Caching a queryset

2010-06-20 Thread ALJ
Noob question 

I have a queryset that holds some very static information (workflow
descriptions and attributes) but is used widely throughout by models
and views.

Is it automatically cached or should I specifically declare somewhere
that I want it cached?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: decoupling project name from import?

2010-06-20 Thread Sithembewena Lloyd Dube
Am a Django noob, and I do not know what your Django proficiency is, but I'd
think you have compromised the strict directory structure that Django
created.  I would:

- Check that your new "apps" folder is on your PATH,
- Consider having the apps folder outside of your foo project,
- See http://docs.djangoproject.com/en/1.2/intro/tutorial03/ for a word on
decoupling apps.

On Sun, Jun 20, 2010 at 9:01 AM, vcarney  wrote:

> I created a new project with django-admin.py as such:
>
> django-admin.py startproject foo
>
> Under the folder foo it gives me the basic files:
> __init__.py
>manage.py
>settings.py
>urls.py
>
> I then created a new folder under foo named apps and added a blank
> __init__.py. Within the apps folder I created a new app with django-
> admin.py instead of manage.py:
>
> django-admin.py startapp bar
>
> This gives me the basic files within bar like models.py. I also
> created a new managers.py file within this same bar directory:
>
> __init__.py
>managers.py
>models.py
>tests.py
>views.py
>
> In my foo/bar/models.py file, I need to import a class from
> managers.py. I have tried "from bar.managers import PublicManger"
> which gives me an ImportError stating no module is named bar.managers.
> However, when I import with "from foo.apps.bar.managers" it works.
>
> How do I decouple the project name within my apps so I may distribute
> the source code?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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,
Sithembewena Lloyd Dube
http://www.lloyddube.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-us...@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: Selling Django

2010-06-20 Thread Richard Shebora
Russ,

Thanks for this clarification.  After reading your post I went to
http://pinaxproject.com/ and do indeed see your point.  I am happy to jump
on board and help with the project that is the generally accepted place for
learning about (i stress learning about for me), and improving django
application portability across django projects.

Is it a consensus that Pinax is this project, even if by default because
it's the best and biggest so far?  I hope so because it has a major head
start and doing any of this work from scratch would be much harder.
 Please let every say Pinax is the one!  If it is not, how
do we agree on the best project to expend time and effort?

Responses? Clarifications? Votes?

Sorry if I seem either redundant or naive in all of this, but I really would
like to resolve this issue, at least for myself because I need to get some
projects up and running.  And the only thing that has been stopping me
is uncertainty about best practices.  I will just get started regardless of
the outcome of this post, but I'd love to have a obvious direction to
proceed.

Thanks,
Richard Shebora

On Fri, Jun 18, 2010 at 8:45 AM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> On Fri, Jun 18, 2010 at 8:16 PM, Richard Shebora 
> wrote:
> > Finn,
> >
> > My idea for a "Pet" project is not to promote a particular project.
> > We simply need a project with a relatively large number of "re-usable"
> > apps that can be brought into compliance with the "Best Practices"
> > guidelines.  While I do see this as a separate effort and needing a
> > separate site, I do think it is pivotal to "selling" django.
> >
> > As a new django developer I am constantly trying to determine the best
> > way to implement a particular use case.  [idea] So, could the
> > enterprise site focus on generating the use cases (pet store selling
> > python's and parots, and such) and the 10,000 foot view explaining
> > them?  Then the best practices site could implement these use cases
> > with detailed docs.  [/idea] This would give a code base that conforms
> > and is re-usable based on real-world needs.  The process of
> > implementing the use cases alone would reveal paths of least
> > resistance in django.
> >
> > Most of my clients are new to the web and assume they need a cms type
> > thing to get started and then build from there.  This is why I tend to
> > develop a cms and then plug everything into it.  I love django and
> > would like to have that boiler plate code in my pocket when I write up
> > a proposal.
>
> I must be missing something, because I honestly can't tell the
> difference between what you're proposing, and what Pinax (and the
> corresponding live-demo site cloud27.com) is intended to do.
>
> There may be aspects of Pinax's documentation that could be improved,
> and there may be features that Pinax doesn't have that are worth
> demonstrating, but it sounds like it would be a lot easier to add
> to/improve on Pinax than to try starting a new project from scratch.
>
> 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-us...@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-us...@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: decoupling project name from import?

2010-06-20 Thread Daniel Roseman
On Jun 20, 8:01 am, vcarney  wrote:
> I created a new project with django-admin.py as such:
>
> django-admin.py startproject foo
>
> Under the folder foo it gives me the basic files:
> __init__.py
>     manage.py
>     settings.py
>     urls.py
>
> I then created a new folder under foo named apps and added a blank
> __init__.py. Within the apps folder I created a new app with django-
> admin.py instead of manage.py:
>
> django-admin.py startapp bar
>
> This gives me the basic files within bar like models.py. I also
> created a new managers.py file within this same bar directory:
>
> __init__.py
>     managers.py
>     models.py
>     tests.py
>     views.py
>
> In my foo/bar/models.py file, I need to import a class from
> managers.py. I have tried "from bar.managers import PublicManger"
> which gives me an ImportError stating no module is named bar.managers.
> However, when I import with "from foo.apps.bar.managers" it works.
>
> How do I decouple the project name within my apps so I may distribute
> the source code?

The 'apps' directory is not on your pythonpath, so you won't be able
to import directly from it without referencing its parent, which is.
However from the bar.models file 'from managers import PublicManager'
should work, because the current file's containing directory is always
automatically on the pythonpath.

I usually use a similar layout, with apps in an 'apps' subdirectory,
and what I usually do is slightly hack the manage.py script to put
apps on the path:
sys.path.insert(0,
os.path.join(
os.path.realpath(os.path.dirname(__file__)), 'apps'
)
)
(and a similar version in my .wsgi file for production).
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Chase Paymentech

2010-06-20 Thread Francis Gulotta
Django bursar should also be mentioned. I'm about to try to use it, but out
of the payment modules I've found it seems the most sane.

http://bitbucket.org/bkroeze/django-bursar/

-Francis

---
Francis Gulotta
wiz...@roborooter.com


On Sun, Jun 20, 2010 at 9:16 AM, Dan Gentry  wrote:

> Storing credit card numbers (and other info) isn't the only concern of
> the PCI standards. If your form collects a number an passes it on to
> the processor, you could also be vulnerable.
>
> On Jun 18, 2:09 pm, surtyaar  wrote:
> > Hi Bobby,
> >
> > You might be interested in a django clone of the sample shopping cart
> > chase paymentech provided (http://store.e-xact.com/).
> >
> > You can get the code and setup instructions here :
> http://github.com/gitaaron/E-xact-django-clone
> >
> > Rgds/
> > Aaron
> >
> > On Apr 20, 10:34 am, Bobby Roberts  wrote:
> >
> >
> >
> > > Hey Bill -
> >
> > > It is my understanding that as long as you do not store credit card
> > > information on your servers, PCI compliance is not an issue.  Chase,
> > > Authorize.net, Paypal, ilovechecks.com etc all have API gateways to
> > > handle the transactions via https protocol which satisfies the
> > > industry financial standards.  I'm just wondering if anyone has infact
> > > worked with the Chase API before
> >
> > > On Apr 20, 10:17 am, Bill Freeman  wrote:
> >
> > > > Beware!  There are a number of security vulnerabilities you can have
> when
> > > > handling credit card numbers.  There is something called PCI (Payment
> Card
> > > > Industry, if I'm not mistaken) compliance, the intent of which is to
> > > > try to avoid
> > > > some of the big credit card number stealing hacks that have been in
> the news
> > > > in recent years.
> >
> > > > For most sites it is better to deal with someone like Authorize.net:
>  These
> > > > services let you point your "checkout" link at them, either with a
> back channel
> > > > identified by order number (which you add to the url) to pick up the
> total, and
> > > > perhaps the item list, or a way to provide that in the get or post
> > > > with a suitable
> > > > signature.  They host a page that you get to style, so you can have,
> > > > for example,
> > > > your color scheme and logo.  They accept the credit card information,
> do the
> > > > dance with the payment processor (such as Chase Paymentech), and, if
> > > > payment is successful, send you a packet, email, or provide a
> webservice
> > > > where you can check, so that you know to "ship".  These services do
> all the
> > > > PCI compliance diligence.  You are safe because the credit card
> information
> > > > never touches your website.
> >
> > > > On Mon, Apr 19, 2010 at 10:17 AM, Bobby Roberts 
> wrote:
> > > > > Has anyone out there integrated a payment module in django over to
> > > > > Chase Paymentech to process credit cards?  I'm looking for sample
> code.
> >
> > > > > --
> > > > > 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 athttp://
> 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-us...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> > > > For more options, visit this group athttp://
> 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-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> > > For more options, visit this group athttp://
> 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-us...@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-us...@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: fieldsets django

2010-06-20 Thread Francis Gulotta
You might want to look into a css solution.

-Francis

---
Francis Gulotta
wiz...@roborooter.com


On Fri, Jun 18, 2010 at 3:40 PM, Waléria Antunes David <
waleriantu...@gmail.com> wrote:

> I have a form with various fields and I need to split these fields so that
> it looks like the image attached. I was reading about FIELDSETS but do not
> know how to use.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Serving media files

2010-06-20 Thread Jagdeep Singh Malhi


On Jun 20, 5:00 pm, Graham Dumpleton 
wrote:
> On Jun 20, 9:17 pm, Jagdeep Singh Malhi 
> wrote:
>
>
>
> > On Jun 20, 3:08 pm, Graham Dumpleton 
> > wrote:
>
> > > On Jun 20, 7:34 pm, Jagdeep Singh Malhi 
> > > wrote:
>
> > > > in  which  file  i see  these lines .
>
> > > >  
> > > > 
> > yes  these links are  shown in source file
>
> > > In your browser, when you request the admin page which isn't showing
> > > the styling, use your browser to view the source code for that page as
> > > the browser received it. This may be under view menu or you can right
> > > click on page to get context menu and it will show option for viewing
> > > source code.
>
> > > Did you validate that the /media/ URL shows those directories?
>
> > /media is not show those directories
> > its display  the   files  of  my operating systems files under media
> > directriy me using  ubuntu 10.04
>
> What do you mean by that? Post what the browser shows when you access:
>
>   /media/
>
> on your site from your browser. Eg. access:
>
>  http://localhost/media/
>
> if access it via localhost.
>
output on browser:-
Index of /media
NameLast modified   SizeDescription
Parent Directory-
css/08-Jun-2010 22:18   -
img/08-Jun-2010 22:18   -
js/ 08-Jun-2010 22:18   -
Apache/2.2.14 (Ubuntu) Server at localhost Port 80

> Note that the trailing slash is important.
>
> There is no point just saying that it doesn't show what I suggest
> should be seen, post what it does show instead.
>
> Also post the output of running:
>
>   ls -las /usr/local/lib/python2.6/dist-packages/django/contrib/admin/
> media/
>
output of this :-
drwxr-sr-x 5 root staff 4096 2010-06-08 22:18 .
4 drwxr-sr-x 6 root staff 4096 2010-06-08 22:18 ..
4 drwxr-sr-x 2 root staff 4096 2010-06-08 22:18 css
4 drwxr-sr-x 4 root staff 4096 2010-06-08 22:18 img
4 drwxr-sr-x 3 root staff 4096 2010-06-08 22:18 js


> Please supply these bits of information, otherwise it is just getting
> too hard to help you. May as well consult a tarot reader if you aren't
> going to provide what is asked or offer up any other information which
> may be relevant to working out what you have done wrong.
>
> > > Did you set those values in settings file back to their default?
>
> > setting is :-
> > MEDIA_ROOT = '/home/your_name/mysite/media/'
>
> > MEDIA_URL = 'http://localhost/media'
>
> > ADMIN_MEDIA_PREFIX = '/media/'
>
> > is this correct or not ???
>
> As I pointed out before, the defaults should work without you having
> changed them. What you have there isn't the defaults I get in settings
> file when I generate a fresh Django site so you must have changed
> them.
>
> Set them back to what I said in other email for now. Ie.,
>
>   MEDIA_ROOT = ''
>   MEDIA_URL = ''
>   ADMIN_MEDIA_PREFIX = '/media/'
>
> Graham
>
Now , I  set default value .
>
>
> > > Graham
>
> > > > On Jun 20, 5:25 am, Graham Dumpleton 
> > > > wrote:
>
> > > > > On Jun 20, 3:06 am, Jagdeep Singh Malhi 
> > > > > wrote:
>
> > > > > > now my httpd.conf   file is :-
>
> > > > > > Alias /media/ /usr/local/lib/python2.6/dist-packages/django/contrib/
> > > > > > admin/media/
>
> > > > > >  > > > > > /usr/local/lib/python2.6/dist-packages/django/contrib/admin/
> > > > > > media/>
> > > > > > Order deny,allow
> > > > > > Allow from all
> > > > > > 
>
> > > > > Change this to:
>
> > > > >    > > > > admin/media/>
> > > > >   Options Indexes
> > > > >   Order deny,allow
> > > > >   Allow from all
> > > > >   
>
> > > > > Then access the URL:
>
> > > > >   /media/
>
> > > > > on your web server via the browser. You should get a response
> > > > > something like:
>
> > > > > Index of /media
>
> > > > >         Name    Last modified   Size    Description
> > > > >         Parent Directory                 -
> > > > >         css/    09-Jun-2010 11:46        -
> > > > >         img/    09-Jun-2010 11:46        -
> > > > >         js/     09-Jun-2010 11:46        -
>
> > > > > If you aren't, then that isn't where the media files are or directory
> > > > > is not accessible to Apache user for some reason.
>
> > > > > Then view the source of the response when access Django admin page.
> > > > > You should see something like:
>
> > > > >   
> > > > >   
> > > > > If you don't see the href link starting with '/media', then you have
> > > > > fiddled the default settings in your Django settings.py to something
> > > > > incompatible. The defaults are:
>
> > > > >   MEDIA_ROOT = ''
> > > > >   MEDIA_URL = ''
> > > > >   ADMIN_MEDIA_PREFIX = '/media/'
>
> > > > > And if left untouched everything should work where media mounted at /
> > > > > media in Apache.
>
> > > > > Graham
>
> > > > > > WSGIScriptAlias / /home/jagdeep/mysite/apache/django.wsgi
>
> > > > > > 
> > > > > > Order allow,deny
> > > > > > Allow from all
> > > > > > 
>
> > > > > > but myhttp://localhost/admin/is not show in graphic format or not
> > > > > > use css files
>
> > > > > > its again show i

Re: Serving media files

2010-06-20 Thread Jagdeep Singh Malhi
Sir  thanks very much indeed  , now its  works.
thanks.



On Jun 20, 11:37 pm, Jagdeep Singh Malhi 
wrote:
> On Jun 20, 5:00 pm, Graham Dumpleton 
> wrote:
>
> > On Jun 20, 9:17 pm, Jagdeep Singh Malhi 
> > wrote:
>
> > > On Jun 20, 3:08 pm, Graham Dumpleton 
> > > wrote:
>
> > > > On Jun 20, 7:34 pm, Jagdeep Singh Malhi 
> > > > wrote:
>
> > > > > in  which  file  i see  these lines .
>
> > > > >  
> > > > > 
> > > yes  these links are  shown in source file
>
> > > > In your browser, when you request the admin page which isn't showing
> > > > the styling, use your browser to view the source code for that page as
> > > > the browser received it. This may be under view menu or you can right
> > > > click on page to get context menu and it will show option for viewing
> > > > source code.
>
> > > > Did you validate that the /media/ URL shows those directories?
>
> > > /media is not show those directories
> > > its display  the   files  of  my operating systems files under media
> > > directriy me using  ubuntu 10.04
>
> > What do you mean by that? Post what the browser shows when you access:
>
> >   /media/
>
> > on your site from your browser. Eg. access:
>
> >  http://localhost/media/
>
> > if access it via localhost.
>
> output on browser:-
> Index of /media
>         Name    Last modified   Size    Description
>         Parent Directory                -
>         css/    08-Jun-2010 22:18       -
>         img/    08-Jun-2010 22:18       -
>         js/     08-Jun-2010 22:18       -
> Apache/2.2.14 (Ubuntu) Server at localhost Port 80
>
> > Note that the trailing slash is important.
>
> > There is no point just saying that it doesn't show what I suggest
> > should be seen, post what it does show instead.
>
> > Also post the output of running:
>
> >   ls -las /usr/local/lib/python2.6/dist-packages/django/contrib/admin/
> > media/
>
> output of this :-
> drwxr-sr-x 5 root staff 4096 2010-06-08 22:18 .
> 4 drwxr-sr-x 6 root staff 4096 2010-06-08 22:18 ..
> 4 drwxr-sr-x 2 root staff 4096 2010-06-08 22:18 css
> 4 drwxr-sr-x 4 root staff 4096 2010-06-08 22:18 img
> 4 drwxr-sr-x 3 root staff 4096 2010-06-08 22:18 js
>
>
>
> > Please supply these bits of information, otherwise it is just getting
> > too hard to help you. May as well consult a tarot reader if you aren't
> > going to provide what is asked or offer up any other information which
> > may be relevant to working out what you have done wrong.
>
> > > > Did you set those values in settings file back to their default?
>
> > > setting is :-
> > > MEDIA_ROOT = '/home/your_name/mysite/media/'
>
> > > MEDIA_URL = 'http://localhost/media'
>
> > > ADMIN_MEDIA_PREFIX = '/media/'
>
> > > is this correct or not ???
>
> > As I pointed out before, the defaults should work without you having
> > changed them. What you have there isn't the defaults I get in settings
> > file when I generate a fresh Django site so you must have changed
> > them.
>
> > Set them back to what I said in other email for now. Ie.,
>
> >   MEDIA_ROOT = ''
> >   MEDIA_URL = ''
> >   ADMIN_MEDIA_PREFIX = '/media/'
>
> > Graham
>
> Now , I  set default value .
>
>
>
> > > > Graham
>
> > > > > On Jun 20, 5:25 am, Graham Dumpleton 
> > > > > wrote:
>
> > > > > > On Jun 20, 3:06 am, Jagdeep Singh Malhi 
> > > > > > wrote:
>
> > > > > > > now my httpd.conf   file is :-
>
> > > > > > > Alias /media/ 
> > > > > > > /usr/local/lib/python2.6/dist-packages/django/contrib/
> > > > > > > admin/media/
>
> > > > > > >  > > > > > > /usr/local/lib/python2.6/dist-packages/django/contrib/admin/
> > > > > > > media/>
> > > > > > > Order deny,allow
> > > > > > > Allow from all
> > > > > > > 
>
> > > > > > Change this to:
>
> > > > > >    > > > > > admin/media/>
> > > > > >   Options Indexes
> > > > > >   Order deny,allow
> > > > > >   Allow from all
> > > > > >   
>
> > > > > > Then access the URL:
>
> > > > > >   /media/
>
> > > > > > on your web server via the browser. You should get a response
> > > > > > something like:
>
> > > > > > Index of /media
>
> > > > > >         Name    Last modified   Size    Description
> > > > > >         Parent Directory                 -
> > > > > >         css/    09-Jun-2010 11:46        -
> > > > > >         img/    09-Jun-2010 11:46        -
> > > > > >         js/     09-Jun-2010 11:46        -
>
> > > > > > If you aren't, then that isn't where the media files are or 
> > > > > > directory
> > > > > > is not accessible to Apache user for some reason.
>
> > > > > > Then view the source of the response when access Django admin page.
> > > > > > You should see something like:
>
> > > > > >    > > > > > />
> > > > > >    > > > > > href="/media/css/login.css" /
>
> > > > > > If you don't see the href link starting with '/media', then you have
> > > > > > fiddled the default settings in your Django settings.py to something
> > > > > > incompatible. The defaults are:
>
> > > > > >   MEDIA_ROOT = ''
> > > > > >   MEDIA_URL = ''
> > > > > >   ADMIN_MEDIA_PREFIX = '/media/'

Re: A Django project life cycle

2010-06-20 Thread Graham Dumpleton


On Jun 20, 10:07 pm, Sam Lai  wrote:
> If you want to run a piece of code on receiving a view HTTP request,
> and a piece of code just before the response is sent to the user, look
> into Django middleware
> (http://docs.djangoproject.com/en/dev/topics/http/middleware/). That
> is what it is specifically designed to do.
>
> If instead you want to run a piece of code when Django starts up, and
> when it is killed, that would depend on how you are serving the page.
> Are you using Apache? With mod_python, or mod_wsgi?
>
> If you're using mod_wsgi (which you should), the mod_wsgi docs are
> quite useful, e.g.http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

Also read:

  http://code.google.com/p/modwsgi/wiki/RegisteringCleanupCode

Per request cleanup code can be done in Django, but in mod_wsgi at
least (not mod_python), one can use atexit module to register process
cleanup functions. Because processes can crash though, you shouldn't
rely on process exit code running.

As to start up, if you are careful and ensure that Django is properly
preloaded outside of request handling per WSGI script on my blog and
referenced else, then can trigger tasks to do on startup when WSGI
script loaded.

Graham

> Also, Django's signals functionality might be help too if middleware
> is not -http://docs.djangoproject.com/en/dev/ref/signals/#ref-signals
>
> On 20 June 2010 21:24, Sameer Rahmani  wrote:
>
>
>
> > i want to run a peace of code in the beginning of life cycle ( may be
> > in settings.py ) but i want to know about
> > number process and the codes that remain on memory ? olso i want to
> > run a peace of code in the ending part
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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-us...@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: Deploying Django with mod_wsgi

2010-06-20 Thread commonzenpython
Graham thanks for all your help, and patience,  i will read the the
information in the link you provided, this is the exact configuration
i added to the httpd.conf file :


LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / /home/ashtanga/public_html/ash/apache/django.wsgi

the path to my Django project is /home/ashtanga/public_html/ash

This is my django.wsgi:

import os
import sys
sys.path.append('/home/ashtanga/public_html/ash') # again i changed
the actual adress for
security purposes but the path leads to my project called ash
os.environ['DJANGO_SETTINGS_MODULE'] = 'ash.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

i will try the quick fix provided by Izantal

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Deploying Django with mod_wsgi

2010-06-20 Thread Graham Dumpleton


On Jun 21, 10:51 am, commonzenpython 
wrote:
> Graham thanks for all your help, and patience,  i will read the the
> information in the link you provided, this is the exact configuration
> i added to the httpd.conf file :
>
> LoadModule wsgi_module modules/mod_wsgi.so
> WSGIScriptAlias / /home/ashtanga/public_html/ash/apache/django.wsgi
>
> the path to my Django project is /home/ashtanga/public_html/ash
>
> This is my django.wsgi:
>
> import os
> import sys
> sys.path.append('/home/ashtanga/public_html/ash') # again i changed

You need parent as well as site directory. Thus:

  sys.path.append('/home/ashtanga/public_html')
  sys.path.append('/home/ashtanga/public_html/ash')

As I said, try the WSGI script in my blog post as that means you only
have to setup one path and don't need to set DJANGO_SETTINGS_MODULE
either as Django will work that out automatically with the way the
final WSGI script in my blog post does things.

Graham

> the actual adress for
> security purposes but the path leads to my project called ash
> os.environ['DJANGO_SETTINGS_MODULE'] = 'ash.settings'
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
>
> i will try the quick fix provided by Izantal

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Selling Django

2010-06-20 Thread Russell Keith-Magee
On Sun, Jun 20, 2010 at 11:51 PM, Richard Shebora  wrote:
> Russ,
> Thanks for this clarification.  After reading your post I went
> to http://pinaxproject.com/ and do indeed see your point.  I am happy to
> jump on board and help with the project that is the generally accepted place
> for learning about (i stress learning about for me), and improving django
> application portability across django projects.
> Is it a consensus that Pinax is this project, even if by default because
> it's the best and biggest so far?  I hope so because it has a major head
> start and doing any of this work from scratch would be much harder.
>  Please let every say Pinax is the one!  If it is not, how
> do we agree on the best project to expend time and effort?
> Responses? Clarifications? Votes?

Pinax is as good an example of large-scale best practice as I'm aware of.

The only other examples I would point at are the reusable apps
published by James Bennett (ubernostrum); he's given numerous talks on
the subject of reusability at various PyCons and DjangoCons; his
talks, blog and book are also useful resources.

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-us...@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: static files, nginx, memcached

2010-06-20 Thread Gabriel Gunderson
On Fri, Jun 18, 2010 at 11:22 AM, TheIvIaxx  wrote:
> I will just have a cron job populate memcached separately.
>
> Is this a common practice or is there a better method for this?

I think the overall approach might need a little more thought, but if
you end up doing something like this, incron would be a far better fit
than cron.

my 2 cents,
Gabe

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: decoupling project name from import?

2010-06-20 Thread vcarney
I attempted to add my apps folder to the wsgi script file, but still
no luck (same module import error). Here is what I have in my wsgi
script file:

import os
import sys

os.environ['DJANGO_SETTINGS_MODULE'] = 'example.settings'
sys.path.append('/apps/django')
sys.path.append('/apps/django/example/apps')
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Any thoughts?

On Jun 20, 11:26 am, Daniel Roseman  wrote:
> On Jun 20, 8:01 am, vcarney  wrote:
>
>
>
> > I created a new project with django-admin.py as such:
>
> > django-admin.py startproject foo
>
> > Under the folder foo it gives me the basic files:
> > __init__.py
> >     manage.py
> >     settings.py
> >     urls.py
>
> > I then created a new folder under foo named apps and added a blank
> > __init__.py. Within the apps folder I created a new app with django-
> > admin.py instead of manage.py:
>
> > django-admin.py startapp bar
>
> > This gives me the basic files within bar like models.py. I also
> > created a new managers.py file within this same bar directory:
>
> > __init__.py
> >     managers.py
> >     models.py
> >     tests.py
> >     views.py
>
> > In my foo/bar/models.py file, I need to import a class from
> > managers.py. I have tried "from bar.managers import PublicManger"
> > which gives me an ImportError stating no module is named bar.managers.
> > However, when I import with "from foo.apps.bar.managers" it works.
>
> > How do I decouple the project name within my apps so I may distribute
> > the source code?
>
> The 'apps' directory is not on your pythonpath, so you won't be able
> to import directly from it without referencing its parent, which is.
> However from the bar.models file 'from managers import PublicManager'
> should work, because the current file's containing directory is always
> automatically on the pythonpath.
>
> I usually use a similar layout, with apps in an 'apps' subdirectory,
> and what I usually do is slightly hack the manage.py script to put
> apps on the path:
>     sys.path.insert(0,
>         os.path.join(
>             os.path.realpath(os.path.dirname(__file__)), 'apps'
>         )
>     )
> (and a similar version in my .wsgi file for production).
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: decoupling project name from import?

2010-06-20 Thread vcarney
I've now got this working by also adding the following to my projects
settings.py file:

import os
import sys
PROJECT_ROOT = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(PROJECT_ROOT, "apps"))

manage.py now knows about my apps folder. See Greg Allard's post for
more info if you run into this -
http://codespatter.com/2009/04/10/how-to-add-locations-to-python-path-for-reusable-django-apps/.

On Jun 20, 10:10 pm, vcarney  wrote:
> I attempted to add my apps folder to the wsgi script file, but still
> no luck (same module import error). Here is what I have in my wsgi
> script file:
>
> import os
> import sys
>
> os.environ['DJANGO_SETTINGS_MODULE'] = 'example.settings'
> sys.path.append('/apps/django')
> sys.path.append('/apps/django/example/apps')
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
>
> Any thoughts?
>
> On Jun 20, 11:26 am, Daniel Roseman  wrote:
>
> > On Jun 20, 8:01 am, vcarney  wrote:
>
> > > I created a new project with django-admin.py as such:
>
> > > django-admin.py startproject foo
>
> > > Under the folder foo it gives me the basic files:
> > > __init__.py
> > >     manage.py
> > >     settings.py
> > >     urls.py
>
> > > I then created a new folder under foo named apps and added a blank
> > > __init__.py. Within the apps folder I created a new app with django-
> > > admin.py instead of manage.py:
>
> > > django-admin.py startapp bar
>
> > > This gives me the basic files within bar like models.py. I also
> > > created a new managers.py file within this same bar directory:
>
> > > __init__.py
> > >     managers.py
> > >     models.py
> > >     tests.py
> > >     views.py
>
> > > In my foo/bar/models.py file, I need to import a class from
> > > managers.py. I have tried "from bar.managers import PublicManger"
> > > which gives me an ImportError stating no module is named bar.managers.
> > > However, when I import with "from foo.apps.bar.managers" it works.
>
> > > How do I decouple the project name within my apps so I may distribute
> > > the source code?
>
> > The 'apps' directory is not on your pythonpath, so you won't be able
> > to import directly from it without referencing its parent, which is.
> > However from the bar.models file 'from managers import PublicManager'
> > should work, because the current file's containing directory is always
> > automatically on the pythonpath.
>
> > I usually use a similar layout, with apps in an 'apps' subdirectory,
> > and what I usually do is slightly hack the manage.py script to put
> > apps on the path:
> >     sys.path.insert(0,
> >         os.path.join(
> >             os.path.realpath(os.path.dirname(__file__)), 'apps'
> >         )
> >     )
> > (and a similar version in my .wsgi file for production).
> > --
> > DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 templates and libraries

2010-06-20 Thread tanman
Hello, I'm trying to setup an existing Django site up on WebFaction.
I've uploaded the code and installed the libraries, but I'm having
trouble getting the site to use my libraries. I've figured out that
when I installed libraries with easy_install, they were installed to /
home/jhumunc/lib/python2.5 instead of /home/jhumunc/webapps/jhumunc/
lib/python2.5 and I found a recommendation to copy all the eggs from
to the latter directory but I don't know if this actually helped at
all. I've also added some of the template directories from within the
eggs to my settings.py file. I'm trying to get the page at
http://www.jhumunc.webfactional.com/accounts/register/ to work
properly. The pages uses the forms library and I've made sure that the
library is on the template_dirs list in the settings.py file (/home/
jhumunc/webapps/jhumunc/lib/python2.5/django_forms-0.5-py2.5.egg/forms/
templates). However, when I load the page, it's saying that it can't
find the templatetags that correspond to that template. I know the
correct directory to look in is /home/jhumunc/webapps/jhumunc/lib/
python2.5/django_forms-0.5-py2.5.egg/forms/templatetags but I can't
figure out where to specify this.

Any help would be appreciated. Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 with Formset (I think it is formset I need)

2010-06-20 Thread Bryan A
Hello:

I am trying to create a form with a check box list for Tags associated
with an Appointment.

Form:
Please list tags for this Appoingmen _ Work
 _ School
 _ Other

I need to design this so users can add additional tags later.

Appoitnemts and Tags are M2M related:

class Appointment(models.Model):
name=   models.CharField(max_length=64)

class Tag(models.Model):
name=   models.CharField(max_length=64, unique=True)
appointments=   models.ManyToManyField(Appointment)

My Forms Class:

class TagForm(forms.Model.Form):
tags=   
forms.ModelMultipleChoiceField(queryset=Tag.objects.all(),

widget=forms.CheckboxSelectMultiple() )

class Meta:
model = Tag

In my view I have also tried:

TagFormSet  =   modelformset_factory(Tag, form=TagForm)
tag_form = Tag  =  TagFormSet(query =
Tag.object.all())

This looks right when the form is displayed, exepct the form is
duplicated once for each Tag in my Db, and clearly this is not pulling
or saving to the Db correctly.

I have looked through the Django documentation, but cannot figure out
how to implement the formset correctly (I think it is a formset I need
here).

Any help would be greatly appreciated.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 with passenger and Staticgenerator ( in dreamhost)

2010-06-20 Thread vishnu.kumar
Hi,

I am trying to use the staticgenerator for my django site.
http://nemesisdesign.net/blog/coding/setup-django-staticgenerator-apache-mod_wsgi/

But that config is not working in my Dreamhost PS, since the link
contains only for apache-wsgi-django.
In Dreamhost, passenger is there.
I am not sure what difference the passenger does but anyway i added
the entries in my virtualhost.
and set the WEB_ROOT in settings.py

But, i got a strange situation
The issue in all is that the static cache is getting generated but the
files are recached every time i refresh my site.
Seems i need something to do in the Passenger level.

Or i think i put the rewrite rules in the wrong place.
Heres my apache config>http://pastebin.com/zyqPiwX0

Can anyone help me in this pls?
If the staticgenerator works my site will handle 6000-7000 requests
per sec.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



PostgreSQL backend - Ident authentication failed?

2010-06-20 Thread Victor Hooi
Hi,

We have a Django application that we just moved from a Ubuntu 9.04
server to 10.04. We're running Apache 2.2/WSGI, with PostgreSQL as the
backend.

My settings.py file:

'DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'mediatracking',  # Or path to
database file if using sqlite3.
#os.path.join(PROJECT_PATH, "templates"),
'USER': 'victorhooi',  # Not used with
sqlite3.
'PASSWORD': 'ourpassword',  # Not used
with sqlite3.
'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for
default. Not used with sqlite3.
}
}

I created a blank PostgreSQL database as myself ("victorhooi").

I ran ./manage.py syncdb, and this seemed to authenticate fine, and
create all the required tables.

When I try to go to http://site.com/admin though, I get an error:

OperationalError at /admin/
FATAL:  Ident authentication failed for user "victorhooi"

I've read elsewhere that you need to do some tom-foolery to disable
ident authentication in PostgreSQL, or something. However, I'm
confused, because:

1. This exact same configuration seemed to work fine on our old
server.
2. The syncdb command works, but actually serving the web page
doesn't.
3. In the error message, it says ident authentication failed for user
"victorhooi", but that's the righ username to authenticate with, isn't
it?

I did notice further down in the error page, under settings:

CSRF_FAILURE_VIEW   'django.views.csrf.csrf_failure'
DATABASES   {'default': 'ENGINE':
'django.db.backends.postgresql_psycopg2', 'HOST': '', 'NAME':
'mediatracking', 'OPTIONS': {}, 'PASSWORD': '',
'PORT': '', 'TEST_CHARSET': None, 'TEST_COLLATION': None,
'TEST_MIRROR': None, 'TEST_NAME': None, 'TIME_ZONE': 'Australia/
Sydney', 'USER': 'victorhooi'}}
DATABASE_ENGINE  ''
DATABASE_HOST   ''
DATABASE_NAME   ''
DATABASE_OPTIONS{}
DATABASE_PASSWORD   ''
DATABASE_PORT   ''
DATABASE_ROUTERS[]
DATABASE_USER   ''
DATETIME_FORMAT 'N j, Y, P'
DATETIME_INPUT_FORMATS  ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M'

Any suggestions?

Cheers,
Victor

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Actions after HttpResponse rendered?

2010-06-20 Thread DaNmarner
There's a similar question as mine on stackoverflow.com:

http://stackoverflow.com/questions/1081340/how-do-you-do-something-after-you-render-the-view-django

and there isn't a satisfactory answer there.

Basically, how do I do some thing after a view returns the response?
Does request_finished enables that kind of operations?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: PostgreSQL backend - Ident authentication failed?

2010-06-20 Thread Torsten Bronger
Hallöchen!

Victor Hooi writes:

> [...]
>
> I created a blank PostgreSQL database as myself ("victorhooi").
>
> I ran ./manage.py syncdb, and this seemed to authenticate fine,
> and create all the required tables.
>
> When I try to go to http://site.com/admin though, I get an error:
>
> OperationalError at /admin/
> FATAL:  Ident authentication failed for user "victorhooi"

Does the webserver also run as victorhooi?  Maybe it runs as
www-data for example.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.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-us...@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: PostgreSQL backend - Ident authentication failed?

2010-06-20 Thread Victor Hooi
heya,

Thanks for the tip. It does work now, following your advice =).

I created a new PostgreSQL user named "www-data". I then changed my
settings.py file:

'USER': 'www-data',  # Not used with
sqlite3.
'PASSWORD': 'ourpassword',  # Not used
with sqlite3.
'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for
default. Not used with sqlite3.
}

However, I'm still curious as to what changed, as I'm fairly sure this
setup worked on the old Ubuntu 9.04 server? And I'm definitely sure
that the database username was set to "victorhooi" on that old system
- I copied the settings.py file over using verbatim (rsync).

Also, is this recommended practice, to use "www-data" as the backend
database username?

Cheers,
Victor

On Jun 21, 3:54 pm, Torsten Bronger 
wrote:
> Hall chen!
>
> Victor Hooi writes:
> > [...]
>
> > I created a blank PostgreSQL database as myself ("victorhooi").
>
> > I ran ./manage.py syncdb, and this seemed to authenticate fine,
> > and create all the required tables.
>
> > When I try to go tohttp://site.com/adminthough, I get an error:
>
> >     OperationalError at /admin/
> >     FATAL:  Ident authentication failed for user "victorhooi"
>
> Does the webserver also run as victorhooi?  Maybe it runs as
> www-data for example.
>
> Tsch ,
> Torsten.
>
> --
> Torsten Bronger, aquisgrana, europa vetus
>                    Jabber ID: torsten.bron...@jabber.rwth-aachen.de
>                                   orhttp://bronger-jmp.appspot.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-us...@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: PostgreSQL backend - Ident authentication failed?

2010-06-20 Thread Kenneth Gonsalves
On Monday 21 June 2010 11:18:27 Victor Hooi wrote:
>   OperationalError at admin
> FATAL:  Ident authentication failed for user "victorhooi"
> 

in pg_hba.conf change the authorisation from ident to password
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: decoupling project name from import?

2010-06-20 Thread Sithembewena Lloyd Dube
Thanks everyone, I could use that link myself.

On Mon, Jun 21, 2010 at 5:23 AM, vcarney  wrote:

> I've now got this working by also adding the following to my projects
> settings.py file:
>
> import os
> import sys
> PROJECT_ROOT = os.path.dirname(__file__)
> sys.path.insert(0, os.path.join(PROJECT_ROOT, "apps"))
>
> manage.py now knows about my apps folder. See Greg Allard's post for
> more info if you run into this -
>
> http://codespatter.com/2009/04/10/how-to-add-locations-to-python-path-for-reusable-django-apps/
> .
>
> On Jun 20, 10:10 pm, vcarney  wrote:
> > I attempted to add my apps folder to the wsgi script file, but still
> > no luck (same module import error). Here is what I have in my wsgi
> > script file:
> >
> > import os
> > import sys
> >
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'example.settings'
> > sys.path.append('/apps/django')
> > sys.path.append('/apps/django/example/apps')
> > import django.core.handlers.wsgi
> > application = django.core.handlers.wsgi.WSGIHandler()
> >
> > Any thoughts?
> >
> > On Jun 20, 11:26 am, Daniel Roseman  wrote:
> >
> > > On Jun 20, 8:01 am, vcarney  wrote:
> >
> > > > I created a new project with django-admin.py as such:
> >
> > > > django-admin.py startproject foo
> >
> > > > Under the folder foo it gives me the basic files:
> > > > __init__.py
> > > > manage.py
> > > > settings.py
> > > > urls.py
> >
> > > > I then created a new folder under foo named apps and added a blank
> > > > __init__.py. Within the apps folder I created a new app with django-
> > > > admin.py instead of manage.py:
> >
> > > > django-admin.py startapp bar
> >
> > > > This gives me the basic files within bar like models.py. I also
> > > > created a new managers.py file within this same bar directory:
> >
> > > > __init__.py
> > > > managers.py
> > > > models.py
> > > > tests.py
> > > > views.py
> >
> > > > In my foo/bar/models.py file, I need to import a class from
> > > > managers.py. I have tried "from bar.managers import PublicManger"
> > > > which gives me an ImportError stating no module is named
> bar.managers.
> > > > However, when I import with "from foo.apps.bar.managers" it works.
> >
> > > > How do I decouple the project name within my apps so I may distribute
> > > > the source code?
> >
> > > The 'apps' directory is not on your pythonpath, so you won't be able
> > > to import directly from it without referencing its parent, which is.
> > > However from the bar.models file 'from managers import PublicManager'
> > > should work, because the current file's containing directory is always
> > > automatically on the pythonpath.
> >
> > > I usually use a similar layout, with apps in an 'apps' subdirectory,
> > > and what I usually do is slightly hack the manage.py script to put
> > > apps on the path:
> > > sys.path.insert(0,
> > > os.path.join(
> > > os.path.realpath(os.path.dirname(__file__)), 'apps'
> > > )
> > > )
> > > (and a similar version in my .wsgi file for production).
> > > --
> > > DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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,
Sithembewena Lloyd Dube
http://www.lloyddube.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-us...@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: PostgreSQL backend - Ident authentication failed?

2010-06-20 Thread Torsten Bronger
Hallöchen!

Victor Hooi writes:

> [...]
>
> However, I'm still curious as to what changed, as I'm fairly sure
> this setup worked on the old Ubuntu 9.04 server? And I'm
> definitely sure that the database username was set to "victorhooi"
> on that old system - I copied the settings.py file over using
> verbatim (rsync).

Maybe pg_hba.conf has changed.

> Also, is this recommended practice, to use "www-data" as the
> backend database username?

No, not recommended, but not forbidden either.  We didn't use
"ident" but "password" in pg_hba.conf.  This way, you are not bound
to user accounts of the underlying operating system.

But possibly we switch to "ident" for local connections
(i.e. command line) and "password" for TCP/IP connections.  The
reason is that passwords make command line scripting harder.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.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-us...@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.