Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Setup_EN

DrClockwork edited this page Feb 25, 2018 · 6 revisions

How to install H5PP

This installation guide is divided into two parts : From scratch, with a new Django project, or if you already have an existing Django project.

Start from scratch

I. Prerequisites

A. Python

You need to have Python installed on your system. H5PP use the version 2.7.x.

You can retrieve it at this address: Python 2.7.9

There is an installer for Windows (MSI Installer) or Mac. If you are on Linux you can use apt :

sudo apt-get install python2.7

You can use Python 3.X version if you want. But you may encouner bugs. We make sure to make the code of the program as compatible as possible with this version of Python

If you have Python >= 2.7.9 (or >= 3.4) you do not need to do this step :

Don't forget to install pip for Python. This will allow you to install or uninstall H5PP in the future : Last version of pip.

B. Django

H5PP use the last major version of Django (1.8.x).

You are therefore free to install any version of Django if it is == 1.8.0 : Installation tutorial for Django. Compatibility with Django > 1.8.0 will arrive soon.

II. Start a new project

When you have Django installed, create a new project to the location of your choice :

django-admin startproject myproject

You have now a project with this files structure :

myproject/
    manage.py
    myproject/
        __init__.py
        settings.py
        urls.py
        wsgi.py

To test your server run this command and try to access to http://localhost:8000 :

python manage.py runserver

If you have installed Django and your project correctly you should be on the example homepage of Django. We can now proceed to install the plugin.

Start from an existing project

I. Prerequisites

You must have Python 2.7.x (or Python 3+ but without any guarantee of stability at the moment), pip for python and Django 1.8.x.

Then you can proceed in two ways :

A. Create the dist package manually

  • Download the H5PP repository (.zip) with github.
  • Unpack it where you want.
  • Go to the root of the plugin (Where is the file setup.py).
  • With a terminal run this command :
python setup.py sdist
  • A 'dist' folder has been created. In this folder is the ready-to-user H5PP package.
  • Go to the root of your Django project (Where is the file manage.py).
  • With a terminal run this command :
pip install <path/to/the/H5PP/Package>
  • If you have no error messages from Pip, the plugin is installed !

B. Install from github

  • Go to the root of your Django project (Where is the file manage.py).
  • With a terminal run this command :
pip install git+git://github.com/drclockwork/H5PP@0.1.8#egg=H5PP

@0.1.8 is the latest version of the plugin. You can easily find it by checking the publishing releases : Releases list.

Replace the number with the release version of your choice.

  • If you have no error messages from Pip, the plugin est installed !

C. Install from pip repository

Soon !

II. Configuration of the plugin

A. Settings of the project

In your settings file (by default settings.py) go to the section INSTALLED_APPS and add this line :

INSTALLED_APPS = [
    ...,
    'h5pp',
]

Next, add these variables (preferably at the end of your file, but you can group them where you want) :

H5P_DEV_MODE = 0
H5P_URL = '/h5p/'
H5P_SAVE = 30
H5P_EXPORT = '/exports/'
H5P_LANGUAGE = 'en'
BASE_URL = 'http://localhost:8000' # Hostname of your server

The explanation of these different variables can be found later in this documentation : Variables.

The variables initialized as above allow H5PP to work with a local server on port 8000.

In your urls file (by default urls.py) add this line to your list of urls :

urlpatterns = [
    ...,
    url(r'^h5p/', include('h5pp.urls')),
]

You can configure the url path to access the various pages related to H5PP. By default I chose h5p/.

If not already done. Make a 'media' directory to the root of your Django project (where is the file manage.py).

III. Run the plugin

A. Database migration

Now it is necessary to prepare the database of the plugin. Just start a migration :

python manage.py migrate

9 tables had to be created by the migration : h5p_libraries, h5p_content, h5p_libraries_libraries, h5p_libraries_languages, h5p_counters, h5p_points, h5p_content_user_data, h5p_contents_libraries and h5p_events.

B. Install the h5p libraries

To test the correct installation of the plugin launch the development server of your project :

python manage.py runserver

Try to access to the homepage of the plugin : http://localhost:8000/h5p/home.

At this step the installation of the plugin is technically finished. But no content type is yet installed.

After accessing the site go to the 'Libraries' page and upload a H5P package : Last release of H5P.

If the installation of the H5P package is successfully completed you must have a list of the types of content available.


H5PP is now installed and usable !