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 %}
<div id="content-main">
<h2><a href='admin'>Amministrazione</a></h2>
<h2><a href='biblioteca'>Biblioteca</a></h2>
</div>
{% endblock %}
------------------------------------------------------------------------------------------------------------------
 


TEMPLATES/DJMSB/LOGIN.HTML---------------------------------------------------------------
 

{% extends "base_site.html" %}

{% block content %}

 {% if form.errors %}
   <p class="error">Sorry, that's not a valid username or password</p>
 {% endif %}

 <form action='.' method='post'>
   <label for="username">User name:</label>
   <input type="text" name="username" value="" id="username">
   <br>
   <label for="password">Password:</label>
   <input type="password" name="password" value="" id="password">
   <br>
   <input type="submit" value="login" />
   <input type="hidden" name="next" value="{{ next|escape }}" />
 <form action='.' method='post'>

{% endblock %}
-------------------------------------------------------------------------------------------------------------------
 


In /etc/apache2/sites-available/ inside the default virtual host 
-------------------
<location "/djmsb">
    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
</location>

Alias /media/ "/var/django/media/"
<Directory "/var/django/media/">
   Options Indexes MultiViews FollowSymLinks
   AllowOverride None
   Order allow,deny
   allow from all
</Directory>
------------------------------------------------------------------------------------------------------------------
 


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
-~----------~----~----~----~------~----~------~--~---

Reply via email to