-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathINSTALL
250 lines (156 loc) · 7.06 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
Installing Booktype 1.5
-----------------------
Note : there are three components to the Booktype Tool Set. This doc
covers only the Booktype (editor/book manager) component and not Espri
(importer) or Objavi (exporter). By default Booktype is hardwired to the
FLOSS Manuals install of Objavi and Espri so you still acquire that
functionality. To detach yourself from the FLOSS Manuals mothership
you need to install Espri and Objavi and configure your install of
Booki accordingly.
This document describes how to install the latest stable versions of
Django, simplejson, and Redis, using python's easy_install. If you
have a sufficiently recent distribution (e.g., Debian Squeeze), you
can just use the distro versions. In that case, skip the easy_install
steps and do whatever is appropriate with your package manager.
Booktype prerequisites
----------------------
Command examples are for Debian/Ubuntu.
- Python, minimum 2.5 (http://www.python.org/) and headers
$ sudo apt-get install python-dev
- PostgreSQL (recommended) or Sqlite3 (not recommended)
$ sudo apt-get install postgresql
or
$ sudo apt-get install sqlite3
- Psycopg (must use this adapter with PostgreSQL)
$ sudo apt-get install python-psycopg2
- git repository manager (http://git-scm.com/)
$ sudo apt-get install git-core
- Python Set Up Tools
$ sudo apt-get install python-setuptools
- Django, minimum 1.2 (http://http://www.djangoproject.com/)
$ sudo easy_install django
or
$ sudo apt-get install python-django
- SimpleJSON
$ sudo easy_install simplejson
- Redis (http://redis.io/)
$ sudo apt-get install redis-server
- South (http://south.aeracode.org/)
$ sudo easy_install South
- lxml (http://codespeak.net/lxml/)
$ sudo apt-get install libxml2-dev and libxslt-dev
$ sudo easy_install lxml
- Unidecode (http://pypi.python.org/pypi/Unidecode)
$ sudo pip install unidecode
Installing from the git repository
----------------------------------
This install doc uses sqlite3 (it is recommended to use PostgreSQL) as its the
easiest to setup so make sure sqlite3 is installed. Do all of the steps as regular
user or www-data user.
1. Clone Booktype
git clone https://github.com/sourcefabric/Booktype.git
2. Change dir to 'booki/scripts'
cd booki/scripts
3. Create booktype instance. If you have write permissions, script will create directory /var/www/mybooktype/. If you don't
have write permissions, administrator should create that directory first.
sudo mkdir /var/www/mybooktype/
sudo chown www-data:www-data /var/www/mybooktype/
./createbooki --database sqlite /var/www/mybooktype/
You can also let create script check if you have installed all needed libraries:
./createbooki --check-versions --database sqlite /var/www/mybooktype/
4. Change directory
cd /var/www/mybooktype/
5. Edit settings
vi settings.py
6. Load environment variables
. ./booki.env
7. Initialize database
django-admin.py syncdb --noinput
8. Migrate
django-admin.py migrate
9. Create superuser account
django-admin.py createsuperuser
10. Add common dokumentation licenses
django-admin.py loaddata documentation_licenses
11. Start redis (If you are using the distro's Redis server, this may
not be necessary or desirable).
redis-server &
12. Start the whole thing
django-admin.py runserver
Then if all is well open your browser and point to something like:
http://127.0.0.1:8000/
How to use Booktype with Apache and mod_wsgi
--------------------------------------------
To install Booktype with Apache, you need to use WSGI or FCGI/SCGI. Consult the
Django documentation at
http://docs.djangoproject.com/en/dev/howto/deployment/.
Createbooki script has created booki.wsgi script for the Apache. Use that
file as part of your Apache config.
How to migrate to latest Booki 1.4
----------------------------------
1. The following should be added to settings.py:
# lulu.com export credentials that override Objavi settings
LULU_USER = None
LULU_PASSWORD = None
LULU_API_KEY = None
2. Templates have been changed. If you have modified template "editor/edit_book.html" you will
have to modify it again. Please be careful about this part of template:
<ul class="bookStatuses template">
{% for s0, s1 in statuses %}
<li id="{{s0}}">{% trans s1 %}</li>
{% endfor %}
</ul>
Some part of template have been separated into:
editor/edit_strings.html
editor/edit_init.html
How to migrate to Booki 1.2
---------------------------
1. There are new template files. Be aware if you have changed template files.
reader/book_info.html (new file)
reader/book_view.html (used to be reader/book.html)
reader/book_chapter.html (used to be reader/chapter.html)
reader/draft_book.html (used to be reader/book.html)
reader/draft_chapter.html (used to be reader/chapter.html)
2. There are new named URL patterns.
book_view (used to be view_book, does not have book version argument anymore)
book_chapter (used to be view_chapter, does not have book version argument anymore)
book_info (new)
draft_book (used to be view_book)
draft_chapter (used to be view_chapter)
draft_attachment
For instance. If you had in your template:
{% url view_chapter book.url_title book_version chap.url_title %}
Now you must use this syntax (notice there is no book version argument):
{% url book_chapter book.url_title chap.url_title %}
3. You must add new default template directory to settings.py file. This is how TEMPLATE_DIR should look like:
TEMPLATE_DIRS = (
'%s/templates/' % BOOKI_ROOT,
'%s/templates/' % os.path.dirname(booki.__file__)
)
4. Read lib/booki/messaging/README.txt how to install new Messaging app.
How to migrate to Booki 1.1
---------------------------
1. Install Booki again with 'createbooki' script
2. Change configuration in new setting.py file (compare it with old configuration)
3. Change attachment path in database. Please change OLD_PATH and NEW_PATH to point to new directories. If you don't do this, attachments will not be accessable.
$ django-admin shell
>>> from booki.editor import models
>>> OLD_PATH = '/Users/aerkalov/Work/git/booki/site_media/static/'
>>> NEW_PATH = '/Users/aerkalov/Work/git/mybooki/data/books/'
>>>
>>> for att in models.Attachment.objects.all():
... print '>> ', att.attachment.name
... name = att.attachment.name.replace(OLD_PATH, NEW_PATH)
... att.attachment.name = name
... att.save()
>>>
>>> from django.contrib.auth.models import User
>>> OLD_PATH = '/Users/aerkalov/Work/git/booki/site_media/static/_profile_images/'
>>> NEW_PATH = '/Users/aerkalov/Work/git/mybooki/data/profile_images/'
>>>
>>> for u in User.objects.all():
... p = u.get_profile()
... print '>>> ', p.image.name
... name = p.image.name.replace(OLD_PATH, NEW_PATH)
... p.image.name = name
... p.save()