| 1 | =========== |
|---|
| 2 | INSTALL |
|---|
| 3 | =========== |
|---|
| 4 | |
|---|
| 5 | Don't worry, Telemeta is easy to setup as any other Django app ! |
|---|
| 6 | |
|---|
| 7 | ----------------- |
|---|
| 8 | Requirements |
|---|
| 9 | ----------------- |
|---|
| 10 | |
|---|
| 11 | Telemeta is designed to run on Linux and other UNIX based architectures. |
|---|
| 12 | It depends on several python librairies like Django (version >= 1.3.1). |
|---|
| 13 | See http://djangoproject.com. |
|---|
| 14 | |
|---|
| 15 | Other needed librairies are listed below. |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | Install the system dependencies |
|---|
| 19 | -------------------------------- |
|---|
| 20 | |
|---|
| 21 | * On Debian (Squeeze recommended) or Ubuntu Lucid: |
|---|
| 22 | |
|---|
| 23 | Install all dependencies like this:: |
|---|
| 24 | |
|---|
| 25 | sudo aptitude install python python-dev python-django python-xml python-mysqldb mysql-server \ |
|---|
| 26 | python-ctypes python-setuptools python-support python-docutils \ |
|---|
| 27 | python-libxml2 python-django-registration python-lxml python-numpy \ |
|---|
| 28 | python-scipy python-imaging python-mutagen python-gobject python-gst0.10 \ |
|---|
| 29 | gstreamer0.10-plugins-base gobject-introspection python-django-south |
|---|
| 30 | |
|---|
| 31 | To get MP3 reading and writing:: |
|---|
| 32 | |
|---|
| 33 | echo 'deb http://www.debian-multimedia.org stable main' | sudo tee -a /etc/apt/sources-list |
|---|
| 34 | sudo apt-get update |
|---|
| 35 | sudo aptitude install gstreamer0.10-fluendo-mp3 gstreamer0.10-lame |
|---|
| 36 | |
|---|
| 37 | * On other linux platforms: |
|---|
| 38 | |
|---|
| 39 | Please install all the equivalent dependencies thanks to your application manager or manually. |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | Install Telemeta |
|---|
| 43 | ----------------------------- |
|---|
| 44 | |
|---|
| 45 | Pip method (highly recommended!) |
|---|
| 46 | +++++++++++++++++++++++++++++++++ |
|---|
| 47 | |
|---|
| 48 | We strongly advise you use the python package tool as it installs some good dependencies automatically:: |
|---|
| 49 | |
|---|
| 50 | sudo aptitude install python-pip |
|---|
| 51 | sudo pip install telemeta |
|---|
| 52 | |
|---|
| 53 | or (deprecated):: |
|---|
| 54 | |
|---|
| 55 | sudo easy_install telemeta |
|---|
| 56 | |
|---|
| 57 | From sources |
|---|
| 58 | +++++++++++++ |
|---|
| 59 | |
|---|
| 60 | Download the latest tar archive at http://telemeta.org. |
|---|
| 61 | |
|---|
| 62 | Uncompress and install it. For example:: |
|---|
| 63 | |
|---|
| 64 | tar xzf telemeta-1.0.tar.gz |
|---|
| 65 | cd telemeta-1.0 |
|---|
| 66 | sudo python setup.py install |
|---|
| 67 | |
|---|
| 68 | Libraries |
|---|
| 69 | +++++++++++ |
|---|
| 70 | |
|---|
| 71 | All those modules have been automatically installed if you used one of the previous methods to install Telemeta. |
|---|
| 72 | In this case only, you can PASS this stage. |
|---|
| 73 | |
|---|
| 74 | But, if you need to hack Telemeta without installing it (i.e. link it through your $PYTHONPATH), you need to install those libraries manually. |
|---|
| 75 | |
|---|
| 76 | TimeSide (web audio components) |
|---|
| 77 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 78 | |
|---|
| 79 | Install it using pip:: |
|---|
| 80 | |
|---|
| 81 | sudo pip install timeside |
|---|
| 82 | |
|---|
| 83 | Or, download the last archive at : |
|---|
| 84 | http://code.google.com/p/timeside/downloads/list |
|---|
| 85 | |
|---|
| 86 | Uncompress it and read README and INSTALL to install the dependencies |
|---|
| 87 | and then the module. |
|---|
| 88 | |
|---|
| 89 | JSON-RPC server |
|---|
| 90 | ~~~~~~~~~~~~~~~~~~ |
|---|
| 91 | |
|---|
| 92 | Install it using pip:: |
|---|
| 93 | |
|---|
| 94 | sudo pip install django-json-rpc |
|---|
| 95 | |
|---|
| 96 | or, from source:: |
|---|
| 97 | |
|---|
| 98 | git clone git://github.com/samuraisam/django-json-rpc.git |
|---|
| 99 | cd django-json-rpc |
|---|
| 100 | python setup.py install |
|---|
| 101 | |
|---|
| 102 | South (schema migration) |
|---|
| 103 | ~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 104 | |
|---|
| 105 | Install it using pip:: |
|---|
| 106 | |
|---|
| 107 | sudo pip install south |
|---|
| 108 | |
|---|
| 109 | or, from source:: |
|---|
| 110 | |
|---|
| 111 | sudo easy_install South |
|---|
| 112 | |
|---|
| 113 | |
|---|
| 114 | ------------------------- |
|---|
| 115 | Testing (sandbox) |
|---|
| 116 | ------------------------- |
|---|
| 117 | |
|---|
| 118 | If you just want to test Telemeta, a sandbox is available in the example/ directory. |
|---|
| 119 | As Telemeta needs MySQL to work properly and fast, please create a database before editing setting.py |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | ------------------------------- |
|---|
| 123 | Create a new Telemeta project |
|---|
| 124 | ------------------------------- |
|---|
| 125 | |
|---|
| 126 | Start the project |
|---|
| 127 | ------------------ |
|---|
| 128 | |
|---|
| 129 | If you haven't already done it, start a new django project:: |
|---|
| 130 | |
|---|
| 131 | cd ~/my_projects |
|---|
| 132 | django-admin startproject mysite |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | Create the database |
|---|
| 136 | ------------------------ |
|---|
| 137 | |
|---|
| 138 | Telemeta needs MySQL to work well and fast. So you need to create a MySQL database before trying it. |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | Configure the telemeta project |
|---|
| 142 | ---------------------------------- |
|---|
| 143 | |
|---|
| 144 | Edit the file settings.py in a text editor. |
|---|
| 145 | Modifiy the following variables:: |
|---|
| 146 | |
|---|
| 147 | ADMINS = telemeta requires that you indicate an administrator here |
|---|
| 148 | DATABASES = your database setting dict (don't forget to create the database if needed) |
|---|
| 149 | MEDIA_ROOT = absolute path to the media directory you just created |
|---|
| 150 | |
|---|
| 151 | Set the app lists as follow:: |
|---|
| 152 | |
|---|
| 153 | INSTALLED_APPS = ( |
|---|
| 154 | 'django.contrib.auth', |
|---|
| 155 | 'django.contrib.contenttypes', |
|---|
| 156 | 'django.contrib.sessions', |
|---|
| 157 | 'django.contrib.sites', |
|---|
| 158 | 'django.contrib.messages', |
|---|
| 159 | 'django.contrib.admin', |
|---|
| 160 | 'telemeta', |
|---|
| 161 | 'jsonrpc', |
|---|
| 162 | 'south' |
|---|
| 163 | ) |
|---|
| 164 | |
|---|
| 165 | Set the following languages:: |
|---|
| 166 | |
|---|
| 167 | LANGUAGES = [ ('fr', 'French'), |
|---|
| 168 | ('en', 'English'), |
|---|
| 169 | ] |
|---|
| 170 | |
|---|
| 171 | |
|---|
| 172 | Set the following Middlewares:: |
|---|
| 173 | |
|---|
| 174 | MIDDLEWARE_CLASSES = ( |
|---|
| 175 | 'django.middleware.common.CommonMiddleware', |
|---|
| 176 | 'django.contrib.sessions.middleware.SessionMiddleware', |
|---|
| 177 | 'django.middleware.csrf.CsrfViewMiddleware', |
|---|
| 178 | 'django.contrib.auth.middleware.AuthenticationMiddleware', |
|---|
| 179 | 'django.contrib.messages.middleware.MessageMiddleware', |
|---|
| 180 | 'django.middleware.locale.LocaleMiddleware', |
|---|
| 181 | ) |
|---|
| 182 | |
|---|
| 183 | Add the following variables:: |
|---|
| 184 | |
|---|
| 185 | TEMPLATE_CONTEXT_PROCESSORS = ( |
|---|
| 186 | 'django.core.context_processors.request', |
|---|
| 187 | 'django.contrib.auth.context_processors.auth',) |
|---|
| 188 | |
|---|
| 189 | TELEMETA_ORGANIZATION = name of the organization which hosts this installation |
|---|
| 190 | TELEMETA_SUBJECTS = tuple of subject keywords (used for Dublin Core), such as "Ethnology", etc... |
|---|
| 191 | TELEMETA_DESCRIPTION = the description of the site |
|---|
| 192 | TELEMETA_CACHE_DIR = absolute path to the cache directory that you just created |
|---|
| 193 | TELEMETA_GMAP_KEY = your Google Map API key |
|---|
| 194 | TELEMETA_DOWNLOAD_ENABLED = True to enable raw audio data download |
|---|
| 195 | TELEMETA_STREAMING_FORMATS = tuple of authorized streaming formats. Ex: ('mp3', 'ogg') |
|---|
| 196 | TELEMETA_DOWNLOAD_FORMATS = tuple of authorized download formats. Ex: ('wav', 'mp3', 'webm') |
|---|
| 197 | TELEMETA_PUBLIC_ACCESS_PERIOD = number of years above which item files are automagically published |
|---|
| 198 | EMAIL_HOST = your default SMTP server |
|---|
| 199 | DEFAULT_FROM_EMAIL = the default sending email address |
|---|
| 200 | |
|---|
| 201 | Just paste the lines below:: |
|---|
| 202 | |
|---|
| 203 | LOGIN_URL = '/login' |
|---|
| 204 | LOGIN_REDIRECT_URL = '/' |
|---|
| 205 | AUTH_PROFILE_MODULE = 'telemeta.userprofile' |
|---|
| 206 | TELEMETA_EXPORT_CACHE_DIR = TELEMETA_CACHE_DIR + "/export" |
|---|
| 207 | TELEMETA_DATA_CACHE_DIR = TELEMETA_CACHE_DIR + "/data" |
|---|
| 208 | CACHE_BACKEND = "file://" + TELEMETA_CACHE_DIR + "/data" |
|---|
| 209 | |
|---|
| 210 | Optional: if you want some personal templates, for example:: |
|---|
| 211 | |
|---|
| 212 | TEMPLATE_DIRS = ( |
|---|
| 213 | '/home/dev/telemeta/sandboxes/sandbox_generic/templates/', |
|---|
| 214 | ) |
|---|
| 215 | |
|---|
| 216 | You can find an example for settings.py there:: |
|---|
| 217 | |
|---|
| 218 | example/sandbox/settings.py |
|---|
| 219 | |
|---|
| 220 | |
|---|
| 221 | Configure your urls |
|---|
| 222 | ---------------------- |
|---|
| 223 | |
|---|
| 224 | Add this dictionary to get Javascript translation:: |
|---|
| 225 | |
|---|
| 226 | js_info_dict = { |
|---|
| 227 | 'packages': ('telemeta',), |
|---|
| 228 | } |
|---|
| 229 | |
|---|
| 230 | The simplest case is to have telemeta running at public root. To do so, add this url in urls.py:: |
|---|
| 231 | |
|---|
| 232 | # Telemeta |
|---|
| 233 | (r'^', include('telemeta.urls')), |
|---|
| 234 | |
|---|
| 235 | # Languages |
|---|
| 236 | (r'^i18n/', include('django.conf.urls.i18n')), |
|---|
| 237 | (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), |
|---|
| 238 | |
|---|
| 239 | You should also bring the django admin:: |
|---|
| 240 | |
|---|
| 241 | (r'^admin/django/', include(admin.site.urls)), |
|---|
| 242 | |
|---|
| 243 | Please also uncomment:: |
|---|
| 244 | |
|---|
| 245 | from django.contrib import admin |
|---|
| 246 | admin.autodiscover() |
|---|
| 247 | |
|---|
| 248 | You can find an example for url.py there:: |
|---|
| 249 | |
|---|
| 250 | example/sandbox/urls.py |
|---|
| 251 | |
|---|
| 252 | |
|---|
| 253 | Initialize the database |
|---|
| 254 | -------------------------- |
|---|
| 255 | |
|---|
| 256 | This synchronizes the DB with the model:: |
|---|
| 257 | |
|---|
| 258 | ./manage.py syncdb |
|---|
| 259 | |
|---|
| 260 | If you want some data schema migrations (South needed):: |
|---|
| 261 | |
|---|
| 262 | ./manage.py migrate telemeta |
|---|
| 263 | |
|---|
| 264 | |
|---|
| 265 | Start the project |
|---|
| 266 | -------------------- |
|---|
| 267 | |
|---|
| 268 | We are ready to start the telemeta server:: |
|---|
| 269 | |
|---|
| 270 | python manage.py runserver |
|---|
| 271 | |
|---|
| 272 | By default, the server starts on the port 8000. You can override this with, for example:: |
|---|
| 273 | |
|---|
| 274 | python manage.py runserver 9000 |
|---|
| 275 | |
|---|
| 276 | To get it on your network interface:: |
|---|
| 277 | |
|---|
| 278 | python manage.py runserver 192.168.0.10:9000 |
|---|
| 279 | |
|---|
| 280 | |
|---|
| 281 | Test it |
|---|
| 282 | ----------- |
|---|
| 283 | |
|---|
| 284 | Go to this URL with your browser:: |
|---|
| 285 | |
|---|
| 286 | http://localhost:8000 |
|---|
| 287 | |
|---|
| 288 | or:: |
|---|
| 289 | |
|---|
| 290 | http://localhost:9000 |
|---|
| 291 | |
|---|
| 292 | or:: |
|---|
| 293 | |
|---|
| 294 | http://192.168.0.10:9000 |
|---|
| 295 | |
|---|
| 296 | |
|---|
| 297 | Configure the site domain name in admin > general admin > sites |
|---|
| 298 | |
|---|
| 299 | Test it and enjoy it ! |
|---|
| 300 | |
|---|
| 301 | |
|---|
| 302 | -------------------------- |
|---|
| 303 | Template customization |
|---|
| 304 | -------------------------- |
|---|
| 305 | |
|---|
| 306 | Please see :: |
|---|
| 307 | |
|---|
| 308 | http://telemeta.org/wiki/InterfaceCustomization |
|---|
| 309 | |
|---|
| 310 | |
|---|
| 311 | -------------------------- |
|---|
| 312 | Deploy it with Apache 2 |
|---|
| 313 | -------------------------- |
|---|
| 314 | |
|---|
| 315 | If you want to use Telemeta through a web server, it is highly recommended to use Apache 2 |
|---|
| 316 | with the mod_wsgi module as explained in the following page :: |
|---|
| 317 | |
|---|
| 318 | http://docs.djangoproject.com/en/1.1/howto/deployment/modwsgi/#howto-deployment-modwsgi |
|---|
| 319 | |
|---|
| 320 | This will prevent Apache to put some audio data in the cache memory as it is usually the case with mod_python. |
|---|
| 321 | |
|---|
| 322 | You can find an example of an Apache2 VirtualHost conf file there:: |
|---|
| 323 | |
|---|
| 324 | example/apache2/telemeta.conf |
|---|
| 325 | |
|---|
| 326 | |
|---|
| 327 | ------------------------- |
|---|
| 328 | IP based authorization |
|---|
| 329 | ------------------------- |
|---|
| 330 | |
|---|
| 331 | It is possible to login automatically an IP range of machines to Telemeta thanks to the django-ipauth module:: |
|---|
| 332 | |
|---|
| 333 | sudo pip install django-ipauth |
|---|
| 334 | |
|---|
| 335 | See http://pypi.python.org/pypi/django-ipauth/ for setup. |
|---|
| 336 | |
|---|
| 337 | |
|---|
| 338 | ---------------------------- |
|---|
| 339 | Import ISO 639-3 languages |
|---|
| 340 | ---------------------------- |
|---|
| 341 | |
|---|
| 342 | From Telemeta 1.4, an ISO 639-3 language model has been implemented. |
|---|
| 343 | |
|---|
| 344 | The ISO language table content can be initialized with the official code set. |
|---|
| 345 | Here is a import example where telemeta_crem5 is the SQL database:: |
|---|
| 346 | |
|---|
| 347 | wget http://www.sil.org/iso639-3/iso-639-3_20110525.tab |
|---|
| 348 | mysql -u root -p |
|---|
| 349 | load data infile 'iso-639-3_20110525.tab' into table telemeta_crem5.languages CHARACTER SET UTF8 ignore 1 lines (identifier, part2B, part2T, part1, scope, type, name, comment); |
|---|
| 350 | |
|---|
| 351 | If you upgraded Telemeta from a version previous or equal to 1.3, please update the media_items table as follow:: |
|---|
| 352 | |
|---|
| 353 | mysql -u root -p |
|---|
| 354 | use telemeta_crem5 |
|---|
| 355 | ALTER TABLE media_items ADD COLUMN 'language_iso_id' integer; |
|---|
| 356 | ALTER TABLE 'media_items' ADD CONSTRAINT 'language_iso_id_refs_id_80b221' FOREIGN KEY ('language_iso_id') REFERENCES 'languages' ('id'); |
|---|
| 357 | |
|---|
| 358 | ------------------------- |
|---|
| 359 | Contact / More infos |
|---|
| 360 | ------------------------- |
|---|
| 361 | |
|---|
| 362 | See README.rst and http://telemeta.org. |
|---|
| 363 | |
|---|