From: zuber Date: Sun, 4 Oct 2009 21:40:33 +0000 (+0200) Subject: - django-cas-consumer i django-cas-provider nie są już wymagane. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/d0deb0f3bebb42475b2b04d0ce389160cc219e44?ds=sidebyside;hp=--cc - django-cas-consumer i django-cas-provider nie są już wymagane. - Poprawienie README.rst i dodanie localsettings.sample. --- d0deb0f3bebb42475b2b04d0ce389160cc219e44 diff --git a/README.rst b/README.rst index 0f4e7ae1..9734694a 100644 --- a/README.rst +++ b/README.rst @@ -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 `_ +* `django-piston 0.2.3rc1 `_ +* `librarian 1.2 `_ +* `lxml 2.2.2 `_ +* `Mercurial 1.3.1 `_ +* `PIL 1.1.6 `_ (wymagane przez skrypt imgconv.py) +* `pngnq `_ (wymagane przez skrypt imgconv.py) + Instalacja -========== +********** 1. Ściągnij i zainstaluj `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 `_ na serwerze `Apache2 `_ przy pomocy załączonego skryptu `dispatch.fcgi`. Inne strategie wdrożeniowe opisane są w `Dokumentacji Django `_. - * `Django 1.1 `_ - * `Mercurial 1.3.1 `_ - * `librarian 1.2 `_ - * `PIL 1.1.6 `_ (wymagane przez skrypt imgconv.py) - * `pngnq `_ (wymagane przez skrypt imgconv.py) diff --git a/project/localsettings.sample b/project/localsettings.sample new file mode 100644 index 00000000..1bac9557 --- /dev/null +++ b/project/localsettings.sample @@ -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/' + diff --git a/project/settings.py b/project/settings.py index 13e0bc59..143f2926 100644 --- a/project/settings.py +++ b/project/settings.py @@ -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 index 12ec48f3..00000000 --- a/project/templates/cas/login.html +++ /dev/null @@ -1,24 +0,0 @@ -{% extends "base.html" %} - -{% block title %} -Login -{% endblock %} - -{% block maincontent %} -
-
- Log in to your account - {% if errors %} -
    - {% for error in errors %} -
  • {{ error|escape }}
  • - {% endfor %} -
- {% endif %} - - {{ form.as_table }} -
-

-
-
-{% endblock %} diff --git a/project/templates/cas/logout.html b/project/templates/cas/logout.html deleted file mode 100644 index a555054b..00000000 --- a/project/templates/cas/logout.html +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "base.html" %} - -{% block title %} -Logged out -{% endblock %} - -{% block maincontent %} -

Logged out

- -

You have successfully logged out. To ensure that you are logged out of all services, please close your browser.

- {% if url %}

Click here to return to {{ url }}

{% endif %} -{% endblock %} diff --git a/project/templates/registration/head_login.html b/project/templates/registration/head_login.html index ded03e97..5eb353d0 100644 --- a/project/templates/registration/head_login.html +++ b/project/templates/registration/head_login.html @@ -1,10 +1,10 @@ {% if user.is_authenticated %} {{ user.username }} | -Wyloguj +Wyloguj {% else %} -{% url django.contrib.auth.views.login as login_url %} +{% url login as login_url %} {% ifnotequal login_url request.path %} - Logowanie + Logowanie {% endifnotequal %} {% endif %} diff --git a/project/urls.py b/project/urls.py index c628d150..a77169d8 100644 --- a/project/urls.py +++ b/project/urls.py @@ -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.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve', {'document_root': settings.STATIC_ROOT, 'show_indexes': True}), ) +# \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 172f733d..bad4a26a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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