# ==========
# Globals
env.project_name = 'platforma'
-env.use_south = False
+env.use_south = True
# Servers
def staging():
def production():
"""Use production server"""
- env.hosts = ['wolnelektury.pl:22123']
- env.user = 'fundacja'
+ env.hosts = ['szo.nowoczesnapolska.org.pl:2225']
+ env.user = 'librarian'
env.path = '/opt/lektury/platforma'
- env.python = '/opt/lektury/basevirtualenv/bin/python'
+ env.python = '/srv/library-in-a-box/sandbox/env/redakcja/bin/python'
env.virtualenv = '/opt/lektury/basevirtualenv/bin/virtualenv'
env.pip = '/opt/lektury/basevirtualenv/bin/pip'
+++ /dev/null
-#!/bin/sh
-nosetests -v --with-doctest --with-coverage --cover-package=vstorage --detailed-errors
+++ /dev/null
-<VirtualHost *:80>
- ServerName %(project_name)s.example.com
- ServerAdmin admin@example.com
-
- WSGIDaemonProcess %(project_name)s user=%(user)s group=%(user)s processes=2 threads=15 display-name=%%{GROUP} python-path=%(path)s/lib/python2.5/site-packages
- WSGIProcessGroup %(project_name)s
-
- WSGIScriptAlias / %(path)s/%(project_name)s.wsgi
- <Directory %(path)s>
- Order allow,deny
- allow from all
- </Directory>
-
- Alias /media %(path)s/media
- <Directory %(path)s/media>
- Options Indexes
- Order allow,deny
- Allow from all
- </Directory>
-
- Alias /admin-media %(path)s/admin-media
- <Directory %(path)s/admin-media>
- Options Indexes
- Order allow,deny
- Allow from all
- </Directory>
-
- Alias /static %(path)s/releases/current/%(project_name)s/static
- <Directory %(path)s/releases/current/%(project_name)s/static>
- Options Indexes
- Order allow,deny
- Allow from all
- </Directory>
-
- LogLevel warn
- ErrorLog /var/log/apache2/error.log
- CustomLog /var/log/apache2/access.log combined
-</VirtualHost>
+++ /dev/null
-#!%(python)s
-import site
-site.addsitedir('%(path)s/lib/python2.5/site-packages')
-
-import os
-from os.path import abspath, dirname, join
-import sys
-
-# Redirect sys.stdout to sys.stderr for bad libraries like geopy that use
-# print statements for optional import exceptions.
-sys.stdout = sys.stderr
-
-# Add apps and lib directories to PYTHONPATH
-sys.path = [
- '%(path)s/releases/current',
- '%(path)s/releases/current/apps',
- '%(path)s/releases/current/lib',
-] + sys.path
-
-# Run Django
-os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
-
-from django.core.handlers.wsgi import WSGIHandler
-application = WSGIHandler()
--- /dev/null
+#
+# 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'
+
+CAS_SERVICE_URL = 'http://stigma.nowoczesnapolska.org.pl/cas/'
+
--- /dev/null
+[loggers]
+keys=root,fnp
+
+[handlers]
+keys=console
+
+[formatters]
+keys=default
+
+[logger_root]
+level=DEBUG
+handlers=console
+
+[logger_fnp]
+level=DEBUG
+handlers=console
+qualname=fnp
+propagate=0
+
+[formatter_default]
+format=%(asctime)s %(name)s/%(levelname)s :: %(module)s.%(funcName)s:%(lineno)d :: %(message)s
+datefmt=
+class=logging.Formatter
+
+[handler_console]
+class=StreamHandler
+level=DEBUG
+formatter=default
+args=(sys.stderr, )
\ No newline at end of file
--- /dev/null
+[loggers]
+keys=root,fnp
+
+[handlers]
+keys=console
+
+[formatters]
+keys=default
+
+[logger_root]
+level=DEBUG
+handlers=console
+
+[logger_fnp]
+level=DEBUG
+handlers=console
+qualname=fnp
+propagate=0
+
+[formatter_default]
+format=%(asctime)s %(name)s/%(levelname)s :: %(module)s.%(funcName)s:%(lineno)d :: %(message)s
+datefmt=
+class=logging.Formatter
+
+[handler_console]
+class=StreamHandler
+level=DEBUG
+formatter=default
+args=(sys.stderr, )
\ No newline at end of file
--- /dev/null
+<VirtualHost *:80>
+ ServerName %(project_name)s.example.com
+ ServerAdmin admin@example.com
+
+ WSGIDaemonProcess %(project_name)s user=%(user)s group=%(user)s processes=2 threads=15 display-name=%%{GROUP} python-path=%(path)s/lib/python2.5/site-packages
+ WSGIProcessGroup %(project_name)s
+
+ WSGIScriptAlias / %(path)s/%(project_name)s.wsgi
+ <Directory %(path)s>
+ Order allow,deny
+ allow from all
+ </Directory>
+
+ Alias /media %(path)s/media
+ <Directory %(path)s/media>
+ Options Indexes
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+ Alias /admin-media %(path)s/admin-media
+ <Directory %(path)s/admin-media>
+ Options Indexes
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+ Alias /static %(path)s/releases/current/%(project_name)s/static
+ <Directory %(path)s/releases/current/%(project_name)s/static>
+ Options Indexes
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+ LogLevel warn
+ ErrorLog /var/log/apache2/error.log
+ CustomLog /var/log/apache2/access.log combined
+</VirtualHost>
--- /dev/null
+#!%(python)s
+import site
+site.addsitedir('%(path)s/lib/python2.5/site-packages')
+
+import os
+from os.path import abspath, dirname, join
+import sys
+
+# Redirect sys.stdout to sys.stderr for bad libraries like geopy that use
+# print statements for optional import exceptions.
+sys.stdout = sys.stderr
+
+# Add apps and lib directories to PYTHONPATH
+sys.path = [
+ '%(path)s/releases/current',
+ '%(path)s/releases/current/apps',
+ '%(path)s/releases/current/lib',
+] + sys.path
+
+# Run Django
+os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
+
+from django.core.handlers.wsgi import WSGIHandler
+application = WSGIHandler()
--- /dev/null
+## Python libraries
+lxml>=2.2
+mercurial>=1.3.1
+PyYAML>=3.0
+
+## Book conversion library
+git+http://github.com/fnp/librarian.git@master#egg=librarian
+
+## Django
+Django>=1.1.1,<1.2
+sorl-thumbnail>=3.2
+django-maintanancemode>=0.9
+
+# migrations
+south>=0.6
+
+## Debugging utils, uncomment this if you want tests
+# django-nose>=0.0.3
+# django-debug-toolbar>=0.8
+
+++ /dev/null
-#
-# 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'
-
-CAS_SERVICE_URL = 'http://stigma.nowoczesnapolska.org.pl/cas/'
-
+++ /dev/null
-[loggers]
-keys=root,fnp
-
-[handlers]
-keys=console
-
-[formatters]
-keys=default
-
-[logger_root]
-level=DEBUG
-handlers=console
-
-[logger_fnp]
-level=DEBUG
-handlers=console
-qualname=fnp
-propagate=0
-
-[formatter_default]
-format=%(asctime)s %(name)s/%(levelname)s :: %(module)s.%(funcName)s:%(lineno)d :: %(message)s
-datefmt=
-class=logging.Formatter
-
-[handler_console]
-class=StreamHandler
-level=DEBUG
-formatter=default
-args=(sys.stderr, )
\ No newline at end of file
+++ /dev/null
-[loggers]
-keys=root,fnp
-
-[handlers]
-keys=console
-
-[formatters]
-keys=default
-
-[logger_root]
-level=DEBUG
-handlers=console
-
-[logger_fnp]
-level=DEBUG
-handlers=console
-qualname=fnp
-propagate=0
-
-[formatter_default]
-format=%(asctime)s %(name)s/%(levelname)s :: %(module)s.%(funcName)s:%(lineno)d :: %(message)s
-datefmt=
-class=logging.Formatter
-
-[handler_console]
-class=StreamHandler
-level=DEBUG
-formatter=default
-args=(sys.stderr, )
\ No newline at end of file
+++ /dev/null
-## Python libraries
-lxml>=2.2
-mercurial>=1.3.1
-PyYAML>=3.0
-
-## Book conversion library
-git+http://github.com/fnp/librarian.git@master#egg=librarian
-
-## Django
-Django>=1.1.1,<1.2
-sorl-thumbnail>=3.2
-django-maintanancemode>=0.9
-
-# migrations
-south>=0.6
-
-## Debugging utils, uncomment this if you want tests
-# django-nose>=0.0.3
-# django-debug-toolbar>=0.8
-
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+from distutils.core import setup
+
+def is_package(path):
+ return (
+ os.path.isdir(path) and
+ os.path.isfile(os.path.join(path, '__init__.py'))
+ )
+
+def find_packages(path, base="" ):
+ """ Find all packages in path """
+ packages = {}
+ for item in os.listdir(path):
+ dir = os.path.join(path, item)
+ if is_package( dir ):
+ if base:
+ module_name = "%(base)s.%(item)s" % vars()
+ else:
+ module_name = item
+ packages[module_name] = dir
+ packages.update(find_packages(dir, module_name))
+ return packages
+
+def files_from(*paths, **kwargs):
+ base = kwargs.pop('base')
+ def generator():
+ for path in paths:
+ path = os.path.join(base, path)
+ print path
+
+ if not os.path.isdir(path) or is_package(path): continue
+
+ for dir, _, files in os.walk(path):
+ for file in files:
+ yield os.path.relpath(os.path.join(dir, file),base)
+
+ return list(generator())
+
+RESOURCE_PATHS = ('templates', 'static', 'media', 'locale', 'config')
+
+def django_setup(project, apps=[], apps_dir='apps', package_dir = {}, packages = [], package_data = {}, **kwargs):
+
+ # directories
+ extra_dirs = dict( (app, os.path.join(apps_dir,app)) for app in apps )
+ extra_dirs[project] = project
+ package_dir.update(extra_dirs)
+
+ # applications
+ packages.extend(apps)
+ # with all subpackages
+ for app in apps:
+ packages.extend(find_packages(os.path.join(apps_dir, app), base=app))
+ # and the project
+ packages.append(project)
+
+ # extra data
+ extra_data = {}
+ for app in apps:
+ extra_data[app] = files_from(*RESOURCE_PATHS, base=os.path.join(apps_dir, app))
+ extra_data[project] = files_from(*RESOURCE_PATHS, base=project)
+ package_data.update(extra_data)
+
+ return setup(
+ package_dir = package_dir,
+ packages = packages,
+ package_data = package_data, **kwargs)
+
+#
+# The reald stuff :)
+#
+django_setup(
+ name='fnp-redakcja',
+ version='1.1',
+ description='IDE for developing books.',
+ author="Fundacja Nowoczesna Polska",
+ author_email='fundacja@nowoczesnapolska.org.pl',
+ license="GNU Affero General Public License 3",
+ maintainer='Łukasz Rekucki',
+ maintainer_email='lrekucki@gmail.com',
+ url='http://github.com/fnp/redakcja',
+ package_dir = {'': 'lib'},
+ py_modules = [
+ 'wlapi',
+ 'vstorage',
+ ],
+ scripts=[
+ 'scripts/crop.py',
+ 'scripts/imgconv.py',
+ ],
+ # django applications
+ project = 'platforma',
+ apps_dir = 'apps',
+ apps = [
+ 'compress',
+ 'django_cas',
+ 'filebrowser',
+ 'toolbar',
+ 'wiki',
+ ],
+ # data_files=[ ('', ['LICENSE', 'NOTICE', 'README.rst', 'AUTHORS.md', 'requirements.txt'])],
+)