From: Łukasz Rekucki Date: Mon, 5 Oct 2009 08:31:45 +0000 (+0200) Subject: Merge branch 'master' of stigma:platforma X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/953ea32f89c36d8ee0f38c5d093fea371e635b90?hp=f32fa7850a8cf57e38d2a7bb4f19c4aeb5d6224a Merge branch 'master' of stigma:platforma --- diff --git a/README.rst b/README.rst new file mode 100644 index 00000000..8ddf4123 --- /dev/null +++ b/README.rst @@ -0,0 +1,38 @@ +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) +* `zuber/django-cas-consumer `_ (wymagane do autoryzacji przez CAS) + +Instalacja +********** +1. Ściągnij i zainstaluj `pip `_ +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 + +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 `_. + diff --git a/README.txt b/README.txt deleted file mode 100644 index 8caa441e..00000000 --- a/README.txt +++ /dev/null @@ -1,13 +0,0 @@ -Zależności -========== - - * [Django 1.1](http://djangoproject.com/) - * [Mercurial 1.3.1](http://www.selenic.com/mercurial/) - * [librarian 1.1](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) - -Moduły -====== - - * redmine -- wtyczka do Redmine dodająca informacje o publikacjach do zagadnień. 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 fc242509..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 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 c8896314..a77169d8 100644 --- a/project/urls.py +++ b/project/urls.py @@ -40,17 +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') ), + ) +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'): @@ -60,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 new file mode 100644 index 00000000..bff92e57 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +Django==1.1 +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#egg=django-cas-consumer \ No newline at end of file