Django installation

Prerequisites

PeTeReport requires Python ≥ 3.8. Recommended installation requires pip. As a base requirement, the following packages are needed:

  • Ubuntu/Debian: $ sudo apt-get install python3-pip python3-venv build-essential
  • OpenSuse: $ sudo zypper install python3-devel gcc
  • CentOS: $ sudo yum install python3-devel gcc

Environment

It is strongly recommended to set up the installation in a virtual environment (Pipenv):

Pipenv

  • Linux: $ sudo apt-get install pipenv
  • pip: $ python3 -m pip install pipenv
  • MAC: $ brew install pipenv

Dependencies

Easiest way in Linux (ubuntu): $ sudo bash scripts/ubuntu_environment_install.sh

Latex

Linux:

$ sudo apt-get install texlive-full

Mac:

$ brew remove basictex
$ brew cask install mactex

Pandoc

Linux:

$ sudo apt-get install pandoc
$ sudo apt-get install python3-pypandoc

Mac:

$ brew install pandoc
$ brew install pandoc-citeproc

Eisvogel

$ python3 -m pip install pandoc-latex-environment
  1. Download the latest version of the Eisvogel template from the release page.
  2. Extract the downloaded ZIP archive and open the folder.
  3. Move the template eisvogel.tex to your pandoc templates folder and rename the file to eisvogel.latex. The location of the templates folder depends on your operating system: /Users/$USER/.pandoc/templates/eisvogel.latex or /home/$USER/.pandoc/templates

PeTeReport

  1. Clone the project and cd into PeTeReport: cd petereport/
  2. Create a new virtual environment and installing dependencies: pipenv install
  3. Run the virtual environment: pipenv shell
  4. Go to Django PeTeReport App: cd app/
  5. Create the database: python manage.py migrate
  6. Make the latest database changes: python manage.py makemigrations
  7. Super user admin/P3t3r3p0rt will be created, but you can create a new super user: python manage.py createsuperuser
  8. Populate the CWE data python manage.py loaddata config/cwe-list.json

Start the server

  1. Run the virtual environment: pipenv shell
  2. Go to Django PeTeReport App: cd app/
  3. Start the django server: python manage.py runserver or python manage.py runserver 0.0.0.0:8000
  4. Go to http://127.0.0.1:8000/
  5. Login with any of users created admin/P3t3r3p0rt (administrator) and viewer/v13w3r (viewer) or the user credentials configured in the configuration file
  6. Try harder
  7. Create a report
  8. Close up and stop the server: Ctrl + C

Upgrade PeTeReport

  1. Stop the server if it's running: Ctrl + C
  2. Pull the latest code base via git: git pull or download the source and replace the files.
  3. Setup any additional dependencies: pipenv install
  4. Run the virtual environment: pipenv shell
  5. Make the latest database changes: python manage.py makemigrations
  6. Make the latest database changes: python manage.py migrate
  7. Start the server: python manage.py runserver
  8. Try harder again

Clean PeTeReport

  1. Stop the server if it's running: Ctrl + C
  2. Run the virtual environment: pipenv shell
  3. Go to Django PeTeReport App: cd app/
  4. Run cleaner: python clean.py
  5. Make the latest database changes: python manage.py makemigrations
  6. Make the latest database changes: python manage.py migrate
  7. Start the server: python manage.py runserver
  8. Try harder again

Configuration

  1. Stop the server if it's running: Ctrl + C
  2. Customize reports and configuration in app/config/petereport_config.py
  3. Start the django server: python manage.py runserver or python manage.py runserver 0.0.0.0:8000