Re: Introducing myself and first question

2008-09-17 Thread Mirto Silvio Busico

R. Gorman ha scritto:
> Wow, sorry I didn't pick up on all the settings and their effects you
> provided - haven't dug into 1.0 myself and the PythonOption
> django.root is a new one for 1.0.  I looked more thoroughly at your
> settings and they all appear correct, you have the root defined in
> apache so you should not need it in your urls.py.  The snag to all
> this is it appears the authentication app does not appear to currently
> use the root option (http://code.djangoproject.com/ticket/8906).  The
> perks of using a new release I suppose.
>
> R.
>
>   
Thanks a lot. It seems exactly the problem in this ticket.
By the way, you car read my complete settings here: http://dpaste.com/78591/

I'll wait for the ticket solution or I'll try a workaround.

Thanks again
Mirto

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Introducing myself and first question

2008-09-17 Thread R. Gorman

Wow, sorry I didn't pick up on all the settings and their effects you
provided - haven't dug into 1.0 myself and the PythonOption
django.root is a new one for 1.0.  I looked more thoroughly at your
settings and they all appear correct, you have the root defined in
apache so you should not need it in your urls.py.  The snag to all
this is it appears the authentication app does not appear to currently
use the root option (http://code.djangoproject.com/ticket/8906).  The
perks of using a new release I suppose.

R.

On Sep 17, 2:57 am, Mirto Silvio Busico <[EMAIL PROTECTED]> wrote:
> Well, this solution doesn't work for me.
> Setting urls to:
> 
> from django.conf.urls.defaults import *
> from django.contrib.auth.views import login, logout
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>     (r'^djmsb/accounts/login/$', 'django.contrib.auth.views.login',
> {'template_name': 'login.html'}),
>     (r'^djmsb/accounts/logout/$', logout),
>     (r'^$', 'djmsb.views.indice'),
>     (r'^biblioteca/', include('djmsb.biblioteca.urls')),
>     (r'^admin/doc/', include('django.contrib.admindocs.urls')),
>     (r'^admin/(.*)', admin.site.root),
> )
> 
>
> [Beware the "r'^$'", "r'^admin/(.*)'" and "r'^biblioteca/' urls work
> correctly because of the "PythonOption django.root /djmsb" line in the
> apache.conf (see my first message)]
>
> Generates two errors:
> In production the apache2 url "http://localhost/djmsb/"; is redirected to
> the incorrect url "http://localhost/accounts/login/?next=/djmsb/"; as
> before (no /djmsb/ in the url)
>
> In development the "http://localhost:8000/"; gives the error:
> 
>
> Page not found (404)
> Request Method:     GET
> Request URL:    http://localhost:8000/accounts/login/
>
> Using the URLconf defined in djmsb.urls, Django tried these URL
> patterns, in this order:
>
>    1. ^djmsb/accounts/login/$
>    2. ^djmsb/accounts/logout/$
>    3. ^$
>    4. ^biblioteca/
>    5. ^admin/doc/
>    6. ^admin/(.*)
>
> The current URL, accounts/login/, didn't match any of these.
> 
>
> It seems that erroneous url is generated by the
> "@login_required(redirect_field_name='next')" statement in views.py
>
> I'm very confused.
>
> What can I try?
> There is any documentation about an entire site under access control?
>
> Thanks
>     Mirto
>
> R. Gorman ha scritto:
>
>
>
> > Ah, I see.  I didn't see that on the first read through - I think I
> > need a nap.  Your URLs are lacking the /djmsb/ because that's how you
> > currently have your url.py patterns setup.  You just need to add
> > 'djmsb/' to the front of your urls:
>
> > from django.conf.urls.defaults import *
> > from django.contrib.auth.views import login, logout
> > from django.contrib import admin
> > admin.autodiscover()
>
> > urlpatterns = patterns('',
> >    (r'^djmsb/accounts/login/$', 'django.contrib.auth.views.login',
> > {'template_name': 'login.html'}),
> >    (r'^djmsb/accounts/logout/$', logout),
> >    (r'^djmsb/$', 'djmsb.views.indice'),
> >    (r'^djmsb/biblioteca/', include('djmsb.biblioteca.urls')),
> >    (r'^djmsb/admin/doc/', include('django.contrib.admindocs.urls')),
> >    (r'^djmsb/admin/(.*)', admin.site.root),
> > )
>
> > R.
>
> --
>
> _
> Busico Mirto Silvio
> Consulente ICT
> cell. 333 4562651
> email [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Introducing myself and first question

2008-09-16 Thread Mirto Silvio Busico

Well, this solution doesn't work for me.
Setting urls to:

from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^djmsb/accounts/login/$', 'django.contrib.auth.views.login', 
{'template_name': 'login.html'}),
(r'^djmsb/accounts/logout/$', logout),
(r'^$', 'djmsb.views.indice'),
(r'^biblioteca/', include('djmsb.biblioteca.urls')),
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/(.*)', admin.site.root),
)


[Beware the "r'^$'", "r'^admin/(.*)'" and "r'^biblioteca/' urls work 
correctly because of the "PythonOption django.root /djmsb" line in the 
apache.conf (see my first message)]

Generates two errors:
In production the apache2 url "http://localhost/djmsb/"; is redirected to 
the incorrect url "http://localhost/accounts/login/?next=/djmsb/"; as 
before (no /djmsb/ in the url)

In development the "http://localhost:8000/"; gives the error:


Page not found (404)
Request Method: GET
Request URL: http://localhost:8000/accounts/login/

Using the URLconf defined in djmsb.urls, Django tried these URL 
patterns, in this order:

   1. ^djmsb/accounts/login/$
   2. ^djmsb/accounts/logout/$
   3. ^$
   4. ^biblioteca/
   5. ^admin/doc/
   6. ^admin/(.*)

The current URL, accounts/login/, didn't match any of these.


It seems that erroneous url is generated by the 
"@login_required(redirect_field_name='next')" statement in views.py

I'm very confused.

What can I try?
There is any documentation about an entire site under access control?

Thanks
Mirto



R. Gorman ha scritto:
> Ah, I see.  I didn't see that on the first read through - I think I
> need a nap.  Your URLs are lacking the /djmsb/ because that's how you
> currently have your url.py patterns setup.  You just need to add
> 'djmsb/' to the front of your urls:
>
> from django.conf.urls.defaults import *
> from django.contrib.auth.views import login, logout
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>(r'^djmsb/accounts/login/$', 'django.contrib.auth.views.login',
> {'template_name': 'login.html'}),
>(r'^djmsb/accounts/logout/$', logout),
>(r'^djmsb/$', 'djmsb.views.indice'),
>(r'^djmsb/biblioteca/', include('djmsb.biblioteca.urls')),
>(r'^djmsb/admin/doc/', include('django.contrib.admindocs.urls')),
>(r'^djmsb/admin/(.*)', admin.site.root),
> )
>
> R.
> >
>
>   


-- 

_
Busico Mirto Silvio
Consulente ICT
cell. 333 4562651
email [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Introducing myself and first question

2008-09-16 Thread R. Gorman

Ah, I see.  I didn't see that on the first read through - I think I
need a nap.  Your URLs are lacking the /djmsb/ because that's how you
currently have your url.py patterns setup.  You just need to add
'djmsb/' to the front of your urls:

from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
   (r'^djmsb/accounts/login/$', 'django.contrib.auth.views.login',
{'template_name': 'login.html'}),
   (r'^djmsb/accounts/logout/$', logout),
   (r'^djmsb/$', 'djmsb.views.indice'),
   (r'^djmsb/biblioteca/', include('djmsb.biblioteca.urls')),
   (r'^djmsb/admin/doc/', include('django.contrib.admindocs.urls')),
   (r'^djmsb/admin/(.*)', admin.site.root),
)

R.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Introducing myself and first question

2008-09-16 Thread Mirto Silvio Busico

R. Gorman ha scritto:
> On Sep 16, 11:32 am, Mirto Silvio Busico <[EMAIL PROTECTED]> wrote:
>
>   
>> DJMSB.VIEWS--
>>
>> from django.shortcuts import render_to_response
>> from django.contrib.auth.decorators import login_required
>> from django.contrib import auth
>>
>> @login_required
>> def indice(request):
>>return render_to_response("index.html", { 'title' : 'DJMSB'})
>> 
>
> If you change your view to:
> @login_required(redirect_field_name='next')
> ...
>
> it should redirect you to the page requested by the user.
>   
Well probably I didn't understand: this seems nnot to work.

I changed the file /var/django/prj/djmsb/views.py and now it is:
___
# Create your views here.
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from django.contrib import auth

@login_required(redirect_field_name='next')
def indice(request):
return render_to_response("index.html", { 'title' : 'DJMSB'})
___

Tried with http://localhost:8000/ (activated with "python manage.py 
runserver") and I'm redirect to 
http://localhost:8000/accounts/login/?next=/ that shows the login form. 
It is OK

Tried (after an apache2 restart) the url: http://localhost/djmsb/ and 
I'm redirect to http://localhost/accounts/login/?next=/djmsb/ that is 
non existent
The correct url should be:  
http://localhost/djmsb/accounts/login/?next=/djmsb/  that works but 
there are two strange things:
The site name (djmsb) was lost--^^
The site name is correctly added in the next 
parameter--^^

If in the URL there is no "djmsb" string apache2 don't know that tis is 
a django site.
If in the next parameter there is no "/djmsb/" value after the login you 
are redirected to the rooti site (http://localhost) istead of the django 
site (http://localhost/djmsb/)

What I'm doing wrong?

Thanks
Mirto
>
> R.
> >
>


-- 

_
Busico Mirto Silvio
Consulente ICT
cell. 333 4562651
email [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Introducing myself and first question

2008-09-16 Thread R. Gorman

On Sep 16, 11:32 am, Mirto Silvio Busico <[EMAIL PROTECTED]> wrote:

>
> DJMSB.VIEWS--
>
> from django.shortcuts import render_to_response
> from django.contrib.auth.decorators import login_required
> from django.contrib import auth
>
> @login_required
> def indice(request):
>    return render_to_response("index.html", { 'title' : 'DJMSB'})

If you change your view to:
@login_required(redirect_field_name='next')
...

it should redirect you to the page requested by the user.

R.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Introducing myself and first question

2008-09-16 Thread Mirto Silvio Busico

Hi all,

I'm starting to use django and to understand if I can do what i need.
My experience is mainly with Plone and I use a Debian/Lenny box.

I digged into the documentation and, after experimenting the 0.96 
version that comes with Lenny, I switched to the 1.0 version from Sid

I need a "private" django site. I mean that accessing the django site 
(mysite in the documentation, djmsb on my box) for an unauthenticated 
user will redirect to a login template.

This should work in development (http://localhost:8000/) and in 
production (http://localhost/djmsb/).
For now I was able to successfully login only in the development framework.

In production the login redirection points to a non existent page 
(http://localhost/accounts/login/?next=/djmsb) instead othe correct page 
(http://localhost/djmsb/accounts/login/?next=/djmsb)
It seems that (for accounts only - the "admin" and "biblioteca" urls 
work fine) the Apache directive "PythonOption django.root /djmsb" is not 
working.

This is my framework:

I created the django site in /var/django/prj/djmsb and an application 
"biblioteca"
So the /var/django tree is:

|-- media
|   |-- css -> 
/usr/share/python-support/python-django/django/contrib/admin/media/css
|   |-- djmsb
|   |   `-- biblioteca
|   |   |-- autori
|   |   |-- copertine
|   |   |   `-- 2008
|   |   |   `-- 09
|   |   `-- scaffali
|   |-- img -> 
/usr/share/python-support/python-django/django/contrib/admin/media/img
|   `-- js -> 
/usr/share/python-support/python-django/django/contrib/admin/media/js
|-- prj
|   |-- djmsb
|   |   `-- biblioteca
|   `-- templates
|   `-- djmsb
|   |-- admin
|   |-- biblioteca
|   `-- registration
`-- repo  (contains the Postgres database)


 
URL.PY 

 

from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
   (r'^accounts/login/$', 'django.contrib.auth.views.login', 
{'template_name': 'login.html'}),
   (r'^accounts/logout/$', logout),
   (r'^$', 'djmsb.views.indice'),
   (r'^biblioteca/', include('djmsb.biblioteca.urls')),
   (r'^admin/doc/', include('django.contrib.admindocs.urls')),
   (r'^admin/(.*)', admin.site.root),
)
-
 


DJMSB.VIEWS--
 

from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from django.contrib import auth

@login_required
def indice(request):
   return render_to_response("index.html", { 'title' : 'DJMSB'})

 


TEMPLATES/DJMSB/INDEX.HTML- 

{% extends "base_site.html" %}
{% block breadcrumbs %}
{% endblock %}
{% block coltype %}colMS{% endblock %}
{% block content %}

Amministrazione
Biblioteca

{% endblock %}
--
 


TEMPLATES/DJMSB/LOGIN.HTML---
 

{% extends "base_site.html" %}

{% block content %}

 {% if form.errors %}
   Sorry, that's not a valid username or password
 {% endif %}

 
   User name:
   
   
   Password:
   
   
   
   
 

{% endblock %}
---
 


In /etc/apache2/sites-available/ inside the default virtual host 
---

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE djmsb.settings
PythonOption DJANGO_SETTINGS_MODULE djmsb.settings
PythonPath "['/var/django/prj'] + sys.path"
PythonDebug On
PythonOption django.root /djmsb
PythonInterpreter djmsb


Alias /media/ "/var/django/media/"

   Options Indexes MultiViews FollowSymLinks
   AllowOverride None
   Order allow,deny
   allow from all

--
 


Any help will be grately appreciated.

Thanks
   Mirto



-- 

_
Busico Mirto Silvio
Consulente ICT
cell. 333 4562651
email [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--