Development Setup
Tech Stack
- The web app is build using the Python web framework Django
- Mozilla's PDF.js is used for viewing PDF files in the browser
- The frondend is build using Alpine.js, htmx and Tailwind CSS
- Authentication, registration, account management and OIDC are achieved by django-allauth
Setup
Note
Make sure you have installed Python 3, Poetry and Node.js on your system before you continue.
Fork the repository and cd into the project:
Create the virtual environment and install all dependencies:
Activate the environment for your shell:
Install frontend dependencies:
Initialize the database:
Create a user for the frontend:
Start the development server with:
# in one shell run
python pdfding/manage.py runserver
# in another run
npx @tailwindcss/cli -i pdfding/static/css/input.css -o pdfding/static/css/tailwind.css --watch
The frontend is now available under http://127.0.0.1:8000. Any changes in regard to Tailwind CSS will be automatically reflected.
Project Structure
PdfDing is built using the Django web framework. You can get started by checking out the excellent Django docs. Currently, PdfDing consists of four applications:
- Inside the
pdffolder is the one related to managing and viewing PDFs - the folder
userscontains the logic related to users - the admin area is implemented inside the
adminfolder coreis the Django root application
Testing
Run all tests with:
It's also possible to run unit tests and e2e tests separately. Unit tests can be run with:
pytest pdfding/admin pdfding/pdf pdfding/users --cov=pdfding/admin --cov=pdfding/pdf --cov=pdfding/users
E2e tests with
Code Quality
Formatting is done via black:
Further code quality checks are done via flake8:
Pre-Commit
This project has support for pre-commit hooks. They are used for checking the code quality,
e.g. with: black, flake8 and bandit. If pre-commit is installed on your system just run
Now whenever you commit your changes the pre-commit hooks will be triggered. If you want to bypass
pre-commit for some reason just add --no-verify to your commit command, e.g.: