Skip to content

TheEnbyperor/vdv-pkpass

Repository files navigation

vdv-pkpass

How to run it locally

Don't. Q didn't intend it that way.

So you've insisted on running it locally anyway

The nix/"easy" way

. Have nix package manager installed, and direnv integrated into your shell. . From this directory, run direnv allow to automatically configure and load all software dependencies . Run the initialise script to run migrations and download supplemental data . Run python manage.py runserver to run the server

The Debian way

System dependencies

apt install libldap2-dev libsasl2-dev slapd ldap-utils

Python

Using python3.13:

apt install software-properties-common
add-apt-repository ppa:deadsnakes/ppa
apt update
apt install python3.13 python3.13-pip python3.13-dev
Using venv
python3.13 -m venv venv
source venv/bin/activate
Python dependencies
pip install -r requirements.txt

Compiling Barkoder

# Dependencies
apt install -y build-essential gcc cmake libgl1 libcurl4-openssl-dev pkg-config
pip install pybind11[global]

# Build folder
mkdir -p barkoder/build
cd barkoder/build

# Build
cmake .. && make

# Copy to site-packages (run in activated virtualenv)
cd ../..
cp ./barkoder/build/Barkoder.cpython-313-x86_64-linux-gnu.so "$(python -c 'import site; print(site.getsitepackages()[0])')"

Other changes

Set an environment environment variable to use development settings:

export DJANGO_SETTINGS_MODULE="vdv_pkpass.settings_dev"

or change ./manage.py:9 to:

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "vdv_pkpass.settings_dev")

Django

mkdir -p ./uic-data
mkdir -p ./vdv-certs
python manage.py migrate
python manage.py download-uic-data
python manage.py download-vdv-certs
python manage.py download-vdv-orgs

Web Server

python manage.py runserver

Conclusion

With all this... it should work (should as defined in RFC 2119)

Tests

Using Muster-Tickets nach UIC 918.9 as provided by Deutsche Bahn:

  • Muster 918-9 FV_SuperSparpreis.pdf
  • Muster 918-9 FV_SuperSparpreis_2Erw.pdf
  • Muster 918-9 FV_SuperSparpreis_3Erw_InklRückfahrt.pdf
  • Muster 918-9 FV_SuperSparpreisSenior_InklRückfahrt.pdf
  • Muster 918-9 FV_SuperSparpreisYoung.pdf
  • Muster 918-9 Länderticket Bayern Nacht.pdf
  • Muster 918-9 Länderticket Rheinland-Pfalz.pdf
  • Muster 918-9 Länderticket Saarland.pdf
  • Muster 918-9 Länderticket Sachsen-Anhalt.pdf
  • Muster 918-9 Länderticket Thüringen.pdf
  • Muster 918-9 Normalpreis.pdf
  • Muster 918-9 Quer-durchs-Land Ticket.pdf
  • Muster 918-9 Schleswig-Holstein Ticket.pdf
  • Muster 918-9 BahnCard 25.png
  • Muster 918-9 CityTicket.pdf
  • Muster 918-9 CityTicket_International.pdf
  • Muster 918-9 Deutschland-Jobticket.png
  • Muster 918-9 Deutschland-Ticket.png