- django-cas-consumer i django-cas-provider nie są już wymagane.
authorzuber <marek@stepniowski.com>
Sun, 4 Oct 2009 21:40:33 +0000 (23:40 +0200)
committerzuber <marek@stepniowski.com>
Sun, 4 Oct 2009 21:40:33 +0000 (23:40 +0200)
 - Poprawienie README.rst i dodanie localsettings.sample.

README.rst
project/localsettings.sample [new file with mode: 0644]
project/settings.py
project/templates/cas/login.html [deleted file]
project/templates/cas/logout.html [deleted file]
project/templates/registration/head_login.html
project/urls.py
requirements.txt

index 0f4e7ae..9734694 100644 (file)
@@ -1,15 +1,37 @@
+Platforma Redakcyjna
+====================
+
+Opis projektu
+*************
+Platforma to serwis służący do grupowej edycji książek na potrzeby serwisu WolneLektury.pl.
+
+Wymagania
+*********
+* `Django 1.1 <http://djangoproject.com/>`_
+* `django-piston 0.2.3rc1 <http://bitbucket.org/jespern/django-piston/>`_
+* `librarian 1.2 <http://redmine.nowoczesnapolska.org.pl/projects/show/librarian>`_
+* `lxml 2.2.2 <http://codespeak.net/lxml/>`_
+* `Mercurial 1.3.1 <http://www.selenic.com/mercurial/>`_
+* `PIL 1.1.6 <http://www.pythonware.com/products/pil/>`_ (wymagane przez skrypt imgconv.py)
+* `pngnq <http://pngnq.sourceforge.net/>`_ (wymagane przez skrypt imgconv.py)
+
 Instalacja
-==========
+**********
 1. Ściągnij i zainstaluj `pip <http://pypi.python.org/pypi/pip>`_
-2. Zainstaluj wymagane biblioteki komendą::
+2. Przejdź do katalogu serwisu w konsoli
+3. Zainstaluj wymagane biblioteki (patrz sekcja wymagania_) komendą::
 
        pip install -f http://redmine.nowoczesnapolska.org.pl/projects/librarian/files -r requirements.txt
 
-Zależności
-==========
+4. Wypełnij bazę danych (Django poprosi o utworzenie pierwszego użytkownika)::
+
+       ./manage.py syncdb
+
+5. Skopiuj zawartość pliku `project/localsettings.sample` do `project/localsettings.py` i zmień go zgodnie ze swoimi potrzebami.
+
+6. Uruchom serwer deweloperski::
+
+       ./manage.py runserver
+
+7. Zalecane jest serwowanie aplikacji przez `modwsgi <http://code.google.com/p/modwsgi/>`_ na serwerze `Apache2 <http://httpd.apache.org/>`_ przy pomocy załączonego skryptu `dispatch.fcgi`. Inne strategie wdrożeniowe opisane są w `Dokumentacji Django <http://docs.djangoproject.com/en/dev/howto/deployment/#howto-deployment-index>`_.
 
- * `Django 1.1 <http://djangoproject.com/>`_
- * `Mercurial 1.3.1 <http://www.selenic.com/mercurial/>`_
- * `librarian 1.2 <http://redmine.nowoczesnapolska.org.pl/projects/show/librarian>`_
- * `PIL 1.1.6 <http://www.pythonware.com/products/pil/>`_ (wymagane przez skrypt imgconv.py)
- * `pngnq <http://pngnq.sourceforge.net/>`_ (wymagane przez skrypt imgconv.py)
diff --git a/project/localsettings.sample b/project/localsettings.sample
new file mode 100644 (file)
index 0000000..1bac955
--- /dev/null
@@ -0,0 +1,39 @@
+# 
+#  localsettings template for Platforma
+#
+#  Duplicate this file as localsettings.py and change it to your liking.
+#  Settings defined in localsettings.py will override settings from 
+#  settings.py file. localsettings.py should never be commited 
+#  to a version control system. Please make changes to settings.py 
+#  or localsettings.sample instead.
+#
+
+# Path to repository with managed documents
+REPOSITORY_PATH = '/home/user/repository'
+
+# Subdirectory of STATIC_ROOT containing images
+IMAGE_DIR = 'images'
+
+# Authentication via Central Authentication Server
+INSTALLED_APPS = (
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.sites',
+    'django.contrib.admin',
+    'django.contrib.admindocs',
+    
+    'cas_consumer',
+    'explorer',
+    'toolbar',
+    'api',
+    'wysiwyg',
+)
+
+AUTHENTICATION_BACKENDS = (
+    'cas_consumer.backends.CASBackend',
+)
+
+CAS_BASE = 'http://localhost:7000/'
+CAS_SERVICE = 'http://localhost:8000/accounts/login/'
+
index 13e0bc5..143f292 100644 (file)
@@ -87,7 +87,7 @@ MIDDLEWARE_CLASSES = (
 ROOT_URLCONF = 'urls'
 
 TEMPLATE_DIRS = (
-    PROJECT_ROOT + '/templates',    
+    PROJECT_ROOT + '/templates',
 )
 
 # CSS and JS files to compress
@@ -116,8 +116,6 @@ INSTALLED_APPS = (
     'django.contrib.admin',
     'django.contrib.admindocs',
     
-    'cas_provider',
-    'cas_consumer',
     'explorer',
     'toolbar',
     'api',
@@ -135,10 +133,6 @@ EDITOR_DEFAULT_SETTINGS = {
     ],
 }
 
-# django-cas-provider
-LOGIN_URL = '/cas/login/'
-LOGOUT_URL = '/cas/logout/'
-
 # Python logging settings
 import logging
 
diff --git a/project/templates/cas/login.html b/project/templates/cas/login.html
deleted file mode 100644 (file)
index 12ec48f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-{% extends "base.html" %}
-
-{% block title %}
-Login
-{% endblock %}
-
-{% block maincontent %}
-  <form action='.' method='post'>
-    <fieldset>
-      <legend>Log in to your account</legend>
-      {% if errors %}
-        <ul>
-            {% for error in errors %}
-                <li>{{ error|escape }}</li>
-            {% endfor %}
-        </ul>
-      {% endif %}
-      <table style="border: none;">
-        {{ form.as_table }}
-      </table>
-      <p><input type="submit" value="Login"/></p>
-    </fieldset>
-  </form>
-{% endblock %}
diff --git a/project/templates/cas/logout.html b/project/templates/cas/logout.html
deleted file mode 100644 (file)
index a555054..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-{% extends "base.html" %}
-
-{% block title %}
-Logged out
-{% endblock %}
-
-{% block maincontent %}
-    <h3>Logged out</h3>
-
-    <p>You have successfully logged out. To ensure that you are logged out of all services, please close your browser.</p>
-    {% if url %}<p><a href="{{ url }}">Click here</a> to return to {{ url }}</p>{% endif %}
-{% endblock %}
index ded03e9..5eb353d 100644 (file)
@@ -1,10 +1,10 @@
 {% if user.is_authenticated %}
 <span class="user_name">{{ user.username }}</span> | 
-<a href='{% url django.contrib.auth.views.logout %}?next={{request.get_full_path}}'>Wyloguj</a>
+<a href='{% url logout %}?next={{request.get_full_path}}'>Wyloguj</a>
 {% else %}
-{% url django.contrib.auth.views.login as login_url %}
+{% url login as login_url %}
 {% ifnotequal login_url request.path %}
-    <a href='{% url django.contrib.auth.views.login %}?next={{request.get_full_path}}'>Logowanie</a>
+    <a href='{{ login_url }}?next={{request.get_full_path}}'>Logowanie</a>
 {% endifnotequal %}
 
 {% endif %}
index c628d15..a77169d 100644 (file)
@@ -40,20 +40,26 @@ urlpatterns = patterns('',
     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
     url(r'^admin/(.*)', admin.site.root),
 
-    # Authorization
-    url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'redirect_field_name': 'next'}),
-    url(r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}),
-
     # Prototypes
     url(r'^wysiwyg-proto/', include('wysiwyg.urls')),
 
     # Our über-restful api
     url(r'^api/', include('api.urls') ),
     
-    # django-cas-provider
-    url(r'^cas/', include('cas_provider.urls')),
 )
 
+if 'cas_consumer' in settings.INSTALLED_APPS:
+    urlpatterns += patterns('',
+        # django-cas-consumer
+        url(r'^accounts/login/$', 'cas_consumer.views.login', name='login'),
+        url(r'^accounts/logout/$', 'cas_consumer.views.logout', name='logout'),
+    )
+else:
+    urlpatterns += patterns('',
+        # Django auth
+        url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'redirect_field_name': 'next'}, name='login'),
+        url(r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}, name='logout'),    
+    )
 
 # Static files
 if settings.DEBUG and not hasattr(settings, 'DONT_SERVE_STATIC'):
@@ -63,3 +69,4 @@ if settings.DEBUG and not hasattr(settings, 'DONT_SERVE_STATIC'):
         url(r'^%s(?P<path>.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve',
             {'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
     )
+# 
\ No newline at end of file
index 172f733..bad4a26 100644 (file)
@@ -3,5 +3,3 @@ django-piston==0.2.3rc1
 librarian==1.2.2
 lxml==2.2.2
 mercurial==1.3.1
--e git://github.com/zuber/django-cas-consumer.git@master#egg=django-cas-consumer
--e git://github.com/zuber/django-cas-provider.git@master#egg=django-cas-provider