Change default config to ease basic setup: DEBUG is True, Celery and search are disabled.
+# Wolne Lektury
+
+![Wolne Lektury](src/wolnelektury/static/img/logo-bez.png)
+
+
+Wolne Lektury is a free internet library maintained by Modern Poland Foundation.
+
+It's a service based on [Django](https://www.djangoproject.com/), using
+[Librarian](https://git.mdrn.pl/librarian.git) to publish books in various formats.
+
+
License
-------
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
+
Dependencies
============
- * Python 3.4+
+ * Python 3.5-3.7
* All packages listed in requirements.txt
- * Sass>=3.2
+
How to deploy (development version)
=============
Translation strings are based on gettext and can be found under 'locale' dir.
There are also JavaScript files for jQuery countdown plugin (static/js/jquery.countdown-*.js).
+
Bundled software
================
with relevant attribution and licensing
-
Authors
=======
* Marek Stępniowski <marek@stepniowski.com>
--- /dev/null
+==============
+Advanced setup
+==============
+
+Changing database backend
+-------------------------
+
+The project does not rely on any features specific to a database backend, so you can choose
+any of the :django:`backends supported by Django <topics/install/#get-your-database-running>`.
+
+
+Search engine
+-------------
+
+.. todo::
+
+ Setting up Solr to be documented.
+
+
+Task queue
+----------
+
+Some tasks (like generating e-books) run in a seperate
+Celery process by default, so you'll also need to run::
+
+ celery -A wolnelektury worker --loglevel=INFO
+
+
+
+Generating PDF files
+--------------------
+
+.. todo::
+
+ To be documented.
+
+
+Generating EPUB files
+---------------------
+
+.. todo::
+
+ To be documented.
+
+
+Generating MOBI files
+---------------------
+
+.. todo::
+
+ To be documented.
--- /dev/null
+===========
+Basic setup
+===========
+
+Wolne Lektury is a `Django <https://www.djangoproject.com/>`_ project.
+
+If you're new to Django, we strongly recommend you complete
+the `Django Girls Tutorial <https://tutorial.djangogirls.org/en/>`_ and/or
+the official :django:`Django Tutorial <getting-started>`
+to learn about setting up a Python virtual environment and general structure
+of a Django project.
+
+Getting started
+---------------
+
+Once you have your Python (version at least 3.5) installed, virtualenv created,
+and the source code of Wolne Lektury checked out to a directory, then the most
+basic setup is as easy as:
+
+ $ pip install -r requirements/requirements.txt
+
+After that, you should be able to run tests:
+
+ $ src/manage.py test
+
+And migrate the database and run the development server:
+
+ $ src/manage.py migrate
+ $ src/manage.py runserver
+
+
+Publishing books
+----------------
+
+Books are represented as XML files.
+You can download some books as source XML files and import them
+into your instance either by using the admin interface,
+or by running::
+
+ src/manage.py importbooks your-directory-with-xml-files
+
+
+What's next?
+------------
+
+This basic setup:
+
+* uses a SQLite file as a database,
+* has search disabled,
+* does not generate PDF, EPUB or MOBI files from books,
+* will generate TXT, HTML, FB2 and cover image files, but will not use a task queue.
+
+In the next section, you'll see what additional setup is needed to solve these issues.
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.viewcode']
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.extlinks', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.viewcode']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
['Fundacja Nowoczesna Polska'], 1)
]
-
-# Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {'http://docs.python.org/': None}
+extlinks = {
+ 'django': (
+ 'https://docs.djangoproject.com/en/%d.%d/%%s' % django.VERSION[:2],
+ None
+ )
+}
--- /dev/null
+==========
+Deployment
+==========
+
.. toctree::
:maxdepth: 2
- installation
+ basic-setup
+ advanced-setup
+ deployment
architecture
reference
+++ /dev/null
-=====
-Setup
-=====
-
-Requirements
-------------
-
-* `Python 3.5-3.7 <http://python.org>`_
-* Python requiremets: ``pip install -r requirements/requirements.txt``
-* a library for your database of choice
- (see `DBs supported by Django <https://docs.djangoproject.com/en/dev/topics/install/#get-your-database-running>`_)
-* `Sass <http://sass-lang.com>`_ >= 3.2 for parsing SCSS stylesheets
-* Librarian has more dependencies if you want to build PDF and MOBI files,
- see lib/librarian/README.md
-* `Solr <https://lucene.apache.org/solr/>`_ server if you want to search
-
-
-Running
--------
-Set up the database with::
-
- ./manage.py migrate
-
-Run the dev server with::
-
- ./manage.py runserver
-
-Some tasks (like generating e-books) run in a seperate
-Celery process by default, so you'll also need to run::
-
- celery -A wolnelektury worker --loglevel=INFO
-
-Or, if you don't want to run a separate Celery daemon, set this
-in your ``localsettings.py``::
-
- CELERY_ALWAYS_EAGER = True
-
-
-Deployment
-----------
-
-TODO
-
-
-Publishing books
-----------------
-
-Books are represented as XML files.
-You can import XML files from a directory by running::
-
- ./manage.py importbooks ../books
-
-Or you can publish a single XML by using publishing form in admin,
-or the publishing API.
# Because of https://github.com/jazzband/django-pipeline/pull/682 + https://github.com/getsentry/sentry-python/issues/436
-e git+https://github.com/jazzband/django-pipeline@3cd2f93bb47bf8d34447e13ff691f7027e7b07a2#egg=django-pipeline
+libsasscompiler==0.1.5
jsmin
fnp-django-pagination==2.2.3
# celery tasks
celery[redis]==4.3.0
-# spell checking
-pyenchant
-
# OAI-PMH
pyoai==2.5.0
@staticmethod
def format_audio_length(seconds):
+ """
+ >>> Book.format_audio_length(1)
+ '0:01'
+ >>> Book.format_audio_length(3661)
+ '1:01:01'
+ """
if seconds < 60*60:
minutes = seconds // 60
seconds = seconds % 60
--- /dev/null
+import doctest
+import unittest
+import catalogue.models.book
+
+
+def load_tests(loader, tests, ignore):
+ tests.addTests(doctest.DocTestSuite(catalogue.models.book))
+ return tests
pass
+# If Celery broker not configured, enable always-eager mode.
+try:
+ CELERY_BROKER_URL
+except NameError:
+ CELERY_TASK_ALWAYS_EAGER = True
+
+
+# If SEARCH_INDEX not configured, disable the search.
+try:
+ SOLR
+except NameError:
+ NO_SEARCH_INDEX = True
+else:
+ NO_SEARCH_INDEX = False
+
+
try:
SENTRY_DSN
except NameError:
dsn=SENTRY_DSN,
integrations=[DjangoIntegration()]
)
+
+
+# Dummy secret key for development.
+try:
+ SECRET_KEY
+except NameError:
+ if DEBUG:
+ SECRET_KEY = 'not-a-secret-key'
from machina import MACHINA_MAIN_TEMPLATE_DIR
from .paths import PROJECT_DIR
-DEBUG = False
+DEBUG = True
MAINTENANCE_MODE = False
ADMINS = [
}
}
-SOLR = "http://localhost:8983/solr/wl/"
SOLR_TEST = "http://localhost:8983/solr/wl_test/"
SOLR_STOPWORDS = "/path/to/solr/data/conf/lang/stopwords_pl.txt"
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
-CELERY_BROKER_URL = 'redis://'
-
CELERY_TASK_EAGER_PROPAGATES = True
CELERY_SEND_TASK_ERROR_EMAILS = True
CELERY_ACCEPT_CONTENT = ['pickle']
# limit number of filtering tags
MAX_TAG_LIST = 6
-NO_SEARCH_INDEX = False
NO_CUSTOM_PDF = True
CATALOGUE_DEFAULT_LANGUAGE = 'pol'
'CSS_COMPRESSOR': None,
'JS_COMPRESSOR': 'pipeline.compressors.jsmin.JSMinCompressor',
'COMPILERS': (
- 'pipeline.compilers.sass.SASSCompiler',
- # We could probably use PySCSS instead,
- # but they have some serious problems, like:
- # https://github.com/Kronuz/pyScss/issues/166 (empty list syntax)
- # https://github.com/Kronuz/pyScss/issues/258 (bad @media order)
- # 'pyscss_compiler.PySCSSCompiler',
+ 'libsasscompiler.LibSassCompiler',
)
}