The new Weitblick website is Django, and Python based. The search engine we use is called Elasticsearch, which is Java based. Downloading this code you can run and test the website with default content on you computer.
If you have Docker installed, you can just run:
docker-compose up
It will install, build and run everything for you. For more info see the Docker Documentation. Changes in the wbcore folder will be avaliable instantly, other changes will require a rebuild of the container using the --build
flag when starting. Otherwise, follow the following steps to set up everything natively.
Required Software & Tools: Python 3, Java 8, Tidy, cairo and Elastic Search 2.
Only necessary for Windows installation. Consider using Chocolatey.
Download Python 3.6.8 from the python website or using a package manager. For example using Chocolatey for Windows.
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
and then run:
python get-pip.py
- for Linux:
sudo -H pip install pipenv
, - for Windows run as Administrator:
pip install pipenv
Go to the project root folder. To install the requirements type:
pipenv install -r requirements.txt --three`
This can take a while. After that you are good to go.
Install Java 8 and be sure to set JAVA_HOME.
Install Elastic Search 2. You can download it here and unzip it.
For windows users an easy way is the installation of GTK2 as it contains cairo. E.g. follow point 2. here
Start Elastic Search.
On unix run :
bin/elasticsearch
or on windows:
bin\elasticsearch.bat
Enter the virtual environment. This is required for all following steps.
pipenv shell
Use the django module command to build the search index:
python manage.py rebuild_index
Accept with y
or add a --noinput
to the rebuild command.
This search index should be updated later when adding content, for example by using a cron job running:
python manage.py update_index
Database migration and loading data can be achieved running the script initalize.sh
python manage.py makemigrations wbcore
python manage.py migrate
Enable support for german
sudo locale-gen de_DE
sudo update-locale
python manage.py loaddata data/address.json
python manage.py loaddata data/locations.json
python manage.py loaddata data/hosts.json
python manage.py loaddata data/images.json
python manage.py loaddata data/news.json
python manage.py loaddata data/blog.json
python manage.py loaddata data/partners.json
python manage.py loaddata data/projects.json
python3 manage.py createsuperuser
Next we run the django server:
python manage.py runserver
Now if everything worked, you can access the website on http://localhost:8000
To enable the login via Microsoft OAuth2 with the official Weitblick intranet accounts visit this site and set the domain name to localhost:8000
.
To update the translations do the following inside the wbcore
directory
django-admin makemessages
django-admin makemessages -d djangojs
For the first time you may have to run django-admin makemessages -l de
or similar for each language.
Fill the translation for newly added translated stings to wbcore/locale/de/LC_MESSAGES/django.po
and .../djangojs.po
.
Finally compile the messeges
django-admin compilemessages
- no such table when database is empty: Run Database Migration