question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Having trouble getting papermerge to run in apache2

See original GitHub issue

Hi, thanks for taking the time to look into this issue.

I am trying to get apache running following the guide at: https://papermerge.readthedocs.io/en/latest/setup/server_configurations.html

I am receiving a 500 error when attempting to browse to the web interface. I receive the following errors in apache error.log.

Any ideas on what I could be doing wrong?

Thanks 😃

[Tue Dec 01 03:12:03.128646 2020] [mpm_event:notice] [pid 52070:tid 139872824998976] AH00489: Apache/2.4.41 (Ubuntu) mod_wsgi/4.7.1 Python/3.8 configured -- resuming normal operations [Tue Dec 01 03:12:03.128904 2020] [core:notice] [pid 52070:tid 139872824998976] AH00094: Command line: '/usr/sbin/apache2' [Tue Dec 01 03:12:07.840581 2020] [wsgi:error] [pid 52071:tid 139872689960704] [client 192.168.1.8:22265] mod_wsgi (pid=52071): Failed to exec Python script file '/var/www/papermerge/config/wsgi.py'. [Tue Dec 01 03:12:07.845902 2020] [wsgi:error] [pid 52071:tid 139872689960704] [client 192.168.1.8:22265] mod_wsgi (pid=52071): Exception occurred processing WSGI script '/var/www/papermerge/config/wsgi.py'. [Tue Dec 01 03:12:07.861047 2020] [wsgi:error] [pid 52071:tid 139872689960704] [client 192.168.1.8:22265] Traceback (most recent call last): [Tue Dec 01 03:12:07.861138 2020] [wsgi:error] [pid 52071:tid 139872689960704] [client 192.168.1.8:22265] File "/var/www/papermerge/config/wsgi.py", line 3, in <module> [Tue Dec 01 03:12:07.861163 2020] [wsgi:error] [pid 52071:tid 139872689960704] [client 192.168.1.8:22265] from django.core.wsgi import get_wsgi_application [Tue Dec 01 03:12:07.861238 2020] [wsgi:error] [pid 52071:tid 139872689960704] [client 192.168.1.8:22265] ModuleNotFoundError: No module named 'django'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18

github_iconTop GitHub Comments

6reactions
jorisvccommented, Dec 2, 2020

Ubuntu is based on Debian so that should normally work. The steps are an installation from scratch. Some path’s can differ with your installation. I have installed Papermerge in /opt/papermerge. The apache user is www-data and the Papermerge configuration file is in /etc/ Papermerge is running as a virtualhost in apache on port 8060

Install GIT apt install git -y

Clone git clone --branch v1.5.0 https://github.com/ciur/papermerge.git /opt/papermerge

install SUDO apt install sudo -y

install dependencies

sudo apt install build-essential \
    python3-pip \
    python3-venv \
    git \
    imagemagick \
    poppler-utils \
    pdftk \
    tesseract-ocr \
    tesseract-ocr-eng \
    tesseract-ocr-deu \
    tesseract-ocr-fra \
    tesseract-ocr-spa \
    tesseract-ocr-nld -y

Prepare python virtual environment

cd /opt/papermerge
python3 -m venv .venv --system-site-packages

Activate it source .venv/bin/activate

Install dependencies pip3 install -r requirements/base.txt

./manage.py migrate

./manage.py createsuperuser

Copy example configuration file to /etc cp /opt/papermerge/papermerge.conf.py.example /etc/papermerge.conf.py

Permissions for Apache chown www-data:www-data /etc/papermerge.conf.py

chmod 770 /etc/papermerge.conf.py

Create static cd /opt/papermerge source .venv/bin/activate ./manage.py collectstatic

Install APACHE apt install apache2 -y

Install WSGI module apt install libapache2-mod-wsgi-py3 -y

Create virtualhost for apache vi /etc/apache2/sites-available/papermerge.conf

<VirtualHost *:8060>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

 ServerName **YOUR SERVER NAME**
    ServerRoot /opt/papermerge

    Alias /static/ /opt/papermerge/static/
    <Directory  /opt/papermerge/static>
        Require all granted
    </Directory>


    Alias /media/ /opt/papermerge/media/
    <Directory  /opt/papermerge/media>
        Require all granted
    </Directory>

    <Directory /opt/papermerge/config/>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

WSGIScriptAlias / /opt/papermerge/config/wsgi.py

</VirtualHost>
WSGIPythonHome /opt/papermerge/.venv/
WSGIPythonPath /opt/papermerge/

Create link to activate virtualhost sudo ln -s /etc/apache2/sites-available/papermerge.conf /etc/apache2/sites-enabled/

Add listening port 8060 to apache vi /etc/apache2/ports.conf

Add 1 line below Listen 80 Listen 8060

Restart apache systemctl restart apache2

Test

1reaction
new0necommented, Jul 15, 2021

I was facing the very same issue, after i entered my login credentials i ran into that “attempt to write a readonly database”. The fix for me was to create a copy of the papermerge.conf.py into my servers /etc/ folder. for a unknown reason the file in the projectfolder was ignored. now its running and using my mysql server: finally. @doughnet: thanks for sharing your way through it, when reading what you did i noticed that i didn’t place my config there! GL everyone

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server Configurations — Papermerge documentation
The most common setup for Papermerge on a linux server is to use Apache, so if you're not sure what to pick, Apache...
Read more >
Common Issues — Papermerge DMS documentation
Common Issues . This document is a compilation of common problems which you may encounter during installation, deployment and general usage of Papermerge....
Read more >
Papermerge DMS with OCR
Free and open source document management system with OCR designed for scanned documents, digital archives, pdf, tiff, jpeg.
Read more >
All release not working since 2.0.0 RC38 anymore - Reddit
Hi! Am I the only one where Papermerge simply not working anymore? All good with 1.55. Since 2.0.0 RC38 is an import, OCR...
Read more >
papermerge-meta-plugin-lidl-receipts-de - Python package
Learn more about papermerge-meta-plugin-lidl-receipts-de: package health ... in issues status has been detected for the GitHub repository.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found