[GH-ISSUE #236] Having trouble getting papermerge to run in apache2 #187

Closed
opened 2026-02-25 21:31:23 +03:00 by kerem · 19 comments
Owner

Originally created by @nblracer880 on GitHub (Dec 1, 2020).
Original GitHub issue: https://github.com/ciur/papermerge/issues/236

Originally assigned to: @ciur on GitHub.

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'

Originally created by @nblracer880 on GitHub (Dec 1, 2020). Original GitHub issue: https://github.com/ciur/papermerge/issues/236 Originally assigned to: @ciur on GitHub. 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'`
kerem 2026-02-25 21:31:23 +03:00
Author
Owner

@jorisvc commented on GitHub (Dec 2, 2020):

Can you check if django is installed?

Go to the papermerge directory, for me this is
/opt/papermerge
Activate the virtual environment with command
source .venv/bin/activate
Check if Django is installed with command
pip show django

If it is missing you should install the Papermerge necessary dependencies with command
pip3 install -r requirements/base.txt

<!-- gh-comment-id:737383056 --> @jorisvc commented on GitHub (Dec 2, 2020): Can you check if django is installed? Go to the papermerge directory, for me this is `/opt/papermerge` Activate the virtual environment with command `source .venv/bin/activate` Check if Django is installed with command `pip show django` If it is missing you should install the Papermerge necessary dependencies with command `pip3 install -r requirements/base.txt`
Author
Owner

@nblracer880 commented on GitHub (Dec 2, 2020):

It appears to be installed. Papermerge runs just fine when I run ./manage.py runserver and ./manage.py worker

Getting it to run with apache has been difficult to say the least though lol.

Thanks for assisting. I really like Papermerge so far, just trying to get everything finalized and running well enough for production use at home. Ideally I just want it to automatically start when my VM boots. I'm not super picky to have it running in dev, but I know having it running on apache would be best.

Here is output for django

chris@papermerge:/opt/papermerge$ source .venv/bin/activate (.venv) chris@papermerge:/opt/papermerge$ pip show django Name: Django Version: 3.0.10 Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design. Home-page: https://www.djangoproject.com/ Author: Django Software Foundation Author-email: foundation@djangoproject.com License: BSD Location: /home/chris/.local/lib/python3.8/site-packages Requires: sqlparse, pytz, asgiref Required-by: djangorestframework, django-taggit, django-rest-knox, django-polymorphic, django-mptt, django-dynamic-preferences, django-allauth

<!-- gh-comment-id:737399949 --> @nblracer880 commented on GitHub (Dec 2, 2020): It appears to be installed. Papermerge runs just fine when I run `./manage.py runserver` and `./manage.py worker` Getting it to run with apache has been difficult to say the least though lol. Thanks for assisting. I really like Papermerge so far, just trying to get everything finalized and running well enough for production use at home. Ideally I just want it to automatically start when my VM boots. I'm not super picky to have it running in dev, but I know having it running on apache would be best. Here is output for django `chris@papermerge:/opt/papermerge$ source .venv/bin/activate (.venv) chris@papermerge:/opt/papermerge$ pip show django Name: Django Version: 3.0.10 Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design. Home-page: https://www.djangoproject.com/ Author: Django Software Foundation Author-email: foundation@djangoproject.com License: BSD Location: /home/chris/.local/lib/python3.8/site-packages Requires: sqlparse, pytz, asgiref Required-by: djangorestframework, django-taggit, django-rest-knox, django-polymorphic, django-mptt, django-dynamic-preferences, django-allauth`
Author
Owner

@jorisvc commented on GitHub (Dec 2, 2020):

I'm using it at home too. I had to troubleshoot the apache installation too. Which Linux distribution are you running? I have documented my steps but i'm using Debian 10 so i'm not sure if my steps will help if you are running something different.

<!-- gh-comment-id:737402334 --> @jorisvc commented on GitHub (Dec 2, 2020): I'm using it at home too. I had to troubleshoot the apache installation too. Which Linux distribution are you running? I have documented my steps but i'm using Debian 10 so i'm not sure if my steps will help if you are running something different.
Author
Owner

@nblracer880 commented on GitHub (Dec 2, 2020):

I'm on Ubuntu 20.04.1 LTS

<!-- gh-comment-id:737403950 --> @nblracer880 commented on GitHub (Dec 2, 2020): I'm on Ubuntu 20.04.1 LTS
Author
Owner

@jorisvc commented on GitHub (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

<!-- gh-comment-id:737420019 --> @jorisvc commented on GitHub (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
Author
Owner

@nblracer880 commented on GitHub (Dec 2, 2020):

Wow thank you. I will give this a shot here in the next couple of days :)

<!-- gh-comment-id:737489726 --> @nblracer880 commented on GitHub (Dec 2, 2020): Wow thank you. I will give this a shot here in the next couple of days :)
Author
Owner

@nblracer880 commented on GitHub (Dec 3, 2020):

Darn still getting 500 error when browsing to the url.

apache2 error log:

(.venv) chris@papermerge:/var/log/apache2$ cat error.log [Thu Dec 03 03:31:05.802363 2020] [mpm_event:notice] [pid 15318:tid 139981204167744] AH00489: Apache/2.4.41 (Ubuntu) mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations [Thu Dec 03 03:31:05.802778 2020] [core:notice] [pid 15318:tid 139981204167744] AH00094: Command line: '/usr/sbin/apache2' [Thu Dec 03 03:31:15.213768 2020] [wsgi:error] [pid 15319:tid 139981079168768] [client 192.168.1.8:7287] mod_wsgi (pid=15319): Failed to exec Python script file '/opt/papermerge/config/wsgi.py'. [Thu Dec 03 03:31:15.213880 2020] [wsgi:error] [pid 15319:tid 139981079168768] [client 192.168.1.8:7287] mod_wsgi (pid=15319): Exception occurred processing WSGI script '/opt/papermerge/config/wsgi.py'. [Thu Dec 03 03:31:15.272365 2020] [wsgi:error] [pid 15319:tid 139981079168768] [client 192.168.1.8:7287] Traceback (most recent call last): [Thu Dec 03 03:31:15.272653 2020] [wsgi:error] [pid 15319:tid 139981079168768] [client 192.168.1.8:7287] File "/opt/papermerge/config/wsgi.py", line 3, in <module> [Thu Dec 03 03:31:15.272695 2020] [wsgi:error] [pid 15319:tid 139981079168768] [client 192.168.1.8:7287] from django.core.wsgi import get_wsgi_application [Thu Dec 03 03:31:15.272794 2020] [wsgi:error] [pid 15319:tid 139981079168768] [client 192.168.1.8:7287] ModuleNotFoundError: No module named 'django' [Thu Dec 03 03:31:15.659465 2020] [wsgi:error] [pid 15320:tid 139981104346880] [client 192.168.1.8:7286] mod_wsgi (pid=15320): Failed to exec Python script file '/opt/papermerge/config/wsgi.py'., referer: http://****:8060/ [Thu Dec 03 03:31:15.659565 2020] [wsgi:error] [pid 15320:tid 139981104346880] [client 192.168.1.8:7286] mod_wsgi (pid=15320): Exception occurred processing WSGI script '/opt/papermerge/config/wsgi.py'., referer: http://****:8060/ [Thu Dec 03 03:31:15.678418 2020] [wsgi:error] [pid 15320:tid 139981104346880] [client 192.168.1.8:7286] Traceback (most recent call last):, referer: http://****:8060/ [Thu Dec 03 03:31:15.678557 2020] [wsgi:error] [pid 15320:tid 139981104346880] [client 192.168.1.8:7286] File "/opt/papermerge/config/wsgi.py", line 3, in <module>, referer: http://****:8060/ [Thu Dec 03 03:31:15.678581 2020] [wsgi:error] [pid 15320:tid 139981104346880] [client 192.168.1.8:7286] from django.core.wsgi import get_wsgi_application, referer: http://****:8060/ [Thu Dec 03 03:31:15.678635 2020] [wsgi:error] [pid 15320:tid 139981104346880] [client 192.168.1.8:7286] ModuleNotFoundError: No module named 'django', referer: http://****:8060/

.conf file:

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

ServerName PaperMerge
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

WSGIPythonHome /opt/papermerge/.venv/ WSGIPythonPath /opt/papermerge/`
<!-- gh-comment-id:737643775 --> @nblracer880 commented on GitHub (Dec 3, 2020): Darn still getting 500 error when browsing to the url. apache2 error log: `(.venv) chris@papermerge:/var/log/apache2$ cat error.log [Thu Dec 03 03:31:05.802363 2020] [mpm_event:notice] [pid 15318:tid 139981204167744] AH00489: Apache/2.4.41 (Ubuntu) mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations [Thu Dec 03 03:31:05.802778 2020] [core:notice] [pid 15318:tid 139981204167744] AH00094: Command line: '/usr/sbin/apache2' [Thu Dec 03 03:31:15.213768 2020] [wsgi:error] [pid 15319:tid 139981079168768] [client 192.168.1.8:7287] mod_wsgi (pid=15319): Failed to exec Python script file '/opt/papermerge/config/wsgi.py'. [Thu Dec 03 03:31:15.213880 2020] [wsgi:error] [pid 15319:tid 139981079168768] [client 192.168.1.8:7287] mod_wsgi (pid=15319): Exception occurred processing WSGI script '/opt/papermerge/config/wsgi.py'. [Thu Dec 03 03:31:15.272365 2020] [wsgi:error] [pid 15319:tid 139981079168768] [client 192.168.1.8:7287] Traceback (most recent call last): [Thu Dec 03 03:31:15.272653 2020] [wsgi:error] [pid 15319:tid 139981079168768] [client 192.168.1.8:7287] File "/opt/papermerge/config/wsgi.py", line 3, in <module> [Thu Dec 03 03:31:15.272695 2020] [wsgi:error] [pid 15319:tid 139981079168768] [client 192.168.1.8:7287] from django.core.wsgi import get_wsgi_application [Thu Dec 03 03:31:15.272794 2020] [wsgi:error] [pid 15319:tid 139981079168768] [client 192.168.1.8:7287] ModuleNotFoundError: No module named 'django' [Thu Dec 03 03:31:15.659465 2020] [wsgi:error] [pid 15320:tid 139981104346880] [client 192.168.1.8:7286] mod_wsgi (pid=15320): Failed to exec Python script file '/opt/papermerge/config/wsgi.py'., referer: http://****:8060/ [Thu Dec 03 03:31:15.659565 2020] [wsgi:error] [pid 15320:tid 139981104346880] [client 192.168.1.8:7286] mod_wsgi (pid=15320): Exception occurred processing WSGI script '/opt/papermerge/config/wsgi.py'., referer: http://****:8060/ [Thu Dec 03 03:31:15.678418 2020] [wsgi:error] [pid 15320:tid 139981104346880] [client 192.168.1.8:7286] Traceback (most recent call last):, referer: http://****:8060/ [Thu Dec 03 03:31:15.678557 2020] [wsgi:error] [pid 15320:tid 139981104346880] [client 192.168.1.8:7286] File "/opt/papermerge/config/wsgi.py", line 3, in <module>, referer: http://****:8060/ [Thu Dec 03 03:31:15.678581 2020] [wsgi:error] [pid 15320:tid 139981104346880] [client 192.168.1.8:7286] from django.core.wsgi import get_wsgi_application, referer: http://****:8060/ [Thu Dec 03 03:31:15.678635 2020] [wsgi:error] [pid 15320:tid 139981104346880] [client 192.168.1.8:7286] ModuleNotFoundError: No module named 'django', referer: http://****:8060/` .conf file: `<VirtualHost *:8060> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined ServerName PaperMerge 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/`
Author
Owner

@jorisvc commented on GitHub (Dec 3, 2020):

Can you move WSGIScriptAlias / /opt/papermerge/config/wsgi.py above ?

Like this:

...
</Directory>

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

</VirtualHost>
WSGIPythonHome /opt/papermerge/.venv/
WSGIPythonPath /opt/papermerge/
<!-- gh-comment-id:737891978 --> @jorisvc commented on GitHub (Dec 3, 2020): Can you move WSGIScriptAlias / /opt/papermerge/config/wsgi.py above </VirtualHost> ? Like this: ``` ... </Directory> WSGIScriptAlias / /opt/papermerge/config/wsgi.py </VirtualHost> WSGIPythonHome /opt/papermerge/.venv/ WSGIPythonPath /opt/papermerge/ ```
Author
Owner

@nblracer880 commented on GitHub (Dec 3, 2020):

I believe I have what you wanted. See below. Still getting 500 error.

Thanks for all your help so far!!!!

cat /etc/apache2/sites-available/papermerge.conf

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

ServerName PaperMerge
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/

cat /var/log/apache2/error.log

[Thu Dec 03 16:19:07.590609 2020] [mpm_event:notice] [pid 33673:tid 139734032997440] AH00491: caught SIGTERM, shutting down

[Thu Dec 03 16:19:36.304595 2020] [mpm_event:notice] [pid 35287:tid 139820102896704] AH00489: Apache/2.4.41 (Ubuntu) mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations

[Thu Dec 03 16:19:36.304760 2020] [core:notice] [pid 35287:tid 139820102896704] AH00094: Command line: '/usr/sbin/apache2'

[Thu Dec 03 16:19:40.044553 2020] [wsgi:error] [pid 35288:tid 139819967571712] [client 192.168.1.8:1756] mod_wsgi (pid=35288): Failed to exec Python script file '/opt/papermerge/config/wsgi.py'.

[Thu Dec 03 16:19:40.044646 2020] [wsgi:error] [pid 35288:tid 139819967571712] [client 192.168.1.8:1756] mod_wsgi (pid=35288): Exception occurred processing WSGI script '/opt/papermerge/config/wsgi>

[Thu Dec 03 16:19:40.055231 2020] [wsgi:error] [pid 35288:tid 139819967571712] [client 192.168.1.8:1756] Traceback (most recent call last):

[Thu Dec 03 16:19:40.055344 2020] [wsgi:error] [pid 35288:tid 139819967571712] [client 192.168.1.8:1756] File "/opt/papermerge/config/wsgi.py", line 3, in <module>

[Thu Dec 03 16:19:40.055359 2020] [wsgi:error] [pid 35288:tid 139819967571712] [client 192.168.1.8:1756] from django.core.wsgi import get_wsgi_application

[Thu Dec 03 16:19:40.055399 2020] [wsgi:error] [pid 35288:tid 139819967571712] [client 192.168.1.8:1756] ModuleNotFoundError: No module named 'django'

[Thu Dec 03 16:19:52.271176 2020] [wsgi:error] [pid 35289:tid 139820082599680] [client 192.168.1.8:1755] mod_wsgi (pid=35289): Failed to exec Python script file '/opt/papermerge/config/wsgi.py'.

[Thu Dec 03 16:19:52.271332 2020] [wsgi:error] [pid 35289:tid 139820082599680] [client 192.168.1.8:1755] mod_wsgi (pid=35289): Exception occurred processing WSGI script '/opt/papermerge/config/wsgi>

[Thu Dec 03 16:19:52.288297 2020] [wsgi:error] [pid 35289:tid 139820082599680] [client 192.168.1.8:1755] Traceback (most recent call last):

[Thu Dec 03 16:19:52.288442 2020] [wsgi:error] [pid 35289:tid 139820082599680] [client 192.168.1.8:1755] File "/opt/papermerge/config/wsgi.py", line 3, in <module>

[Thu Dec 03 16:19:52.288464 2020] [wsgi:error] [pid 35289:tid 139820082599680] [client 192.168.1.8:1755] from django.core.wsgi import get_wsgi_application

[Thu Dec 03 16:19:52.288532 2020] [wsgi:error] [pid 35289:tid 139820082599680] [client 192.168.1.8:1755] ModuleNotFoundError: No module named 'django'

<!-- gh-comment-id:738121544 --> @nblracer880 commented on GitHub (Dec 3, 2020): I believe I have what you wanted. See below. Still getting 500 error. Thanks for all your help so far!!!! **`cat /etc/apache2/sites-available/papermerge.conf`** `<VirtualHost *:80>` ` ErrorLog ${APACHE_LOG_DIR}/error.log` ` CustomLog ${APACHE_LOG_DIR}/access.log combined` ` ServerName PaperMerge` `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/` **`cat /var/log/apache2/error.log`** `[Thu Dec 03 16:19:07.590609 2020] [mpm_event:notice] [pid 33673:tid 139734032997440] AH00491: caught SIGTERM, shutting down` `[Thu Dec 03 16:19:36.304595 2020] [mpm_event:notice] [pid 35287:tid 139820102896704] AH00489: Apache/2.4.41 (Ubuntu) mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations` `[Thu Dec 03 16:19:36.304760 2020] [core:notice] [pid 35287:tid 139820102896704] AH00094: Command line: '/usr/sbin/apache2'` `[Thu Dec 03 16:19:40.044553 2020] [wsgi:error] [pid 35288:tid 139819967571712] [client 192.168.1.8:1756] mod_wsgi (pid=35288): Failed to exec Python script file '/opt/papermerge/config/wsgi.py'.` `[Thu Dec 03 16:19:40.044646 2020] [wsgi:error] [pid 35288:tid 139819967571712] [client 192.168.1.8:1756] mod_wsgi (pid=35288): Exception occurred processing WSGI script '/opt/papermerge/config/wsgi>` `[Thu Dec 03 16:19:40.055231 2020] [wsgi:error] [pid 35288:tid 139819967571712] [client 192.168.1.8:1756] Traceback (most recent call last):` `[Thu Dec 03 16:19:40.055344 2020] [wsgi:error] [pid 35288:tid 139819967571712] [client 192.168.1.8:1756] File "/opt/papermerge/config/wsgi.py", line 3, in <module>` `[Thu Dec 03 16:19:40.055359 2020] [wsgi:error] [pid 35288:tid 139819967571712] [client 192.168.1.8:1756] from django.core.wsgi import get_wsgi_application` `[Thu Dec 03 16:19:40.055399 2020] [wsgi:error] [pid 35288:tid 139819967571712] [client 192.168.1.8:1756] ModuleNotFoundError: No module named 'django'` `[Thu Dec 03 16:19:52.271176 2020] [wsgi:error] [pid 35289:tid 139820082599680] [client 192.168.1.8:1755] mod_wsgi (pid=35289): Failed to exec Python script file '/opt/papermerge/config/wsgi.py'.` `[Thu Dec 03 16:19:52.271332 2020] [wsgi:error] [pid 35289:tid 139820082599680] [client 192.168.1.8:1755] mod_wsgi (pid=35289): Exception occurred processing WSGI script '/opt/papermerge/config/wsgi>` `[Thu Dec 03 16:19:52.288297 2020] [wsgi:error] [pid 35289:tid 139820082599680] [client 192.168.1.8:1755] Traceback (most recent call last):` `[Thu Dec 03 16:19:52.288442 2020] [wsgi:error] [pid 35289:tid 139820082599680] [client 192.168.1.8:1755] File "/opt/papermerge/config/wsgi.py", line 3, in <module>` `[Thu Dec 03 16:19:52.288464 2020] [wsgi:error] [pid 35289:tid 139820082599680] [client 192.168.1.8:1755] from django.core.wsgi import get_wsgi_application` `[Thu Dec 03 16:19:52.288532 2020] [wsgi:error] [pid 35289:tid 139820082599680] [client 192.168.1.8:1755] ModuleNotFoundError: No module named 'django'`
Author
Owner

@jorisvc commented on GitHub (Dec 3, 2020):

This is weird.

I have installed a clean Ubuntu 20.04.1 LTS virtual machine and ran all the command i mentioned above. I ran all the commands with sudo.

I had to run 3 additional commands to make it work without any issues:

To set permission

sudo chown -R www-data:www-data /opt/papermerge/
sudo chmod -R 770 /opt/papermerge/

Create a symlink for python (i didn't had to do that in Debian)
sudo ln -s /usr/bin/python3 /usr/bin/python

<!-- gh-comment-id:738356816 --> @jorisvc commented on GitHub (Dec 3, 2020): This is weird. I have installed a clean Ubuntu 20.04.1 LTS virtual machine and ran all the command i mentioned above. I ran all the commands with sudo. I had to run 3 additional commands to make it work without any issues: To set permission ``` sudo chown -R www-data:www-data /opt/papermerge/ sudo chmod -R 770 /opt/papermerge/ ``` Create a symlink for python (i didn't had to do that in Debian) `sudo ln -s /usr/bin/python3 /usr/bin/python`
Author
Owner

@nblracer880 commented on GitHub (Dec 4, 2020):

I'm going to spin up a new VM and take it from the top today. I'll let you know how it goes. Thanks again for the help :)

<!-- gh-comment-id:738909440 --> @nblracer880 commented on GitHub (Dec 4, 2020): I'm going to spin up a new VM and take it from the top today. I'll let you know how it goes. Thanks again for the help :)
Author
Owner

@nblracer880 commented on GitHub (Dec 5, 2020):

Spun up a new VM and ran through again. Still getting the 500 error. But I did notice something when running: pip3 install -r requirements/base.txt in th venv

WARNING: The script sqlformat is installed in '/home/chris/.local/bin' which is not on PATH.

Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

WARNING: The script django-admin is installed in '/home/chris/.local/bin' which is not on PATH.

Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

WARNING: The script celery is installed in '/home/chris/.local/bin' which is not on PATH.

Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

WARNING: The scripts futurize and pasteurize are installed in '/home/chris/.local/bin' which is not on PATH.

Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Apache error log again, though I believe it is the same as before.

[Sat Dec 05 19:14:33.295874 2020] [wsgi:error] [pid 14158:tid 140577510795008] [client 192.168.1.8:34766] Traceback (most recent call last):

[Sat Dec 05 19:14:33.295993 2020] [wsgi:error] [pid 14158:tid 140577510795008] [client 192.168.1.8:34766] File "/opt/papermerge/config/wsgi.py", line 3, in <module>

[Sat Dec 05 19:14:33.296015 2020] [wsgi:error] [pid 14158:tid 140577510795008] [client 192.168.1.8:34766] from django.core.wsgi import get_wsgi_application

[Sat Dec 05 19:14:33.296069 2020] [wsgi:error] [pid 14158:tid 140577510795008] [client 192.168.1.8:34766] ModuleNotFoundError: No module named 'django'

[Sat Dec 05 19:14:33.630112 2020] [wsgi:error] [pid 14159:tid 140577544365824] [client 192.168.1.8:34767] mod_wsgi (pid=14159): Failed to exec Python script file '/opt/papermerge/config/wsgi.py'., referer: http://****:8060/

[Sat Dec 05 19:14:33.630205 2020] [wsgi:error] [pid 14159:tid 140577544365824] [client 192.168.1.8:34767] mod_wsgi (pid=14159): Exception occurred processing WSGI script '/opt/papermerge/config/wsgi.py'., referer: http://****:8060/

[Sat Dec 05 19:14:33.643991 2020] [wsgi:error] [pid 14159:tid 140577544365824] [client 192.168.1.8:34767] Traceback (most recent call last):, referer: http://****:8060/

<!-- gh-comment-id:739342373 --> @nblracer880 commented on GitHub (Dec 5, 2020): Spun up a new VM and ran through again. Still getting the 500 error. But I did notice something when running: `pip3 install -r requirements/base.txt` in th venv `WARNING: The script sqlformat is installed in '/home/chris/.local/bin' which is not on PATH.` `Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.` `WARNING: The script django-admin is installed in '/home/chris/.local/bin' which is not on PATH.` `Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.` `WARNING: The script celery is installed in '/home/chris/.local/bin' which is not on PATH.` `Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.` `WARNING: The scripts futurize and pasteurize are installed in '/home/chris/.local/bin' which is not on PATH.` `Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.` **Apache error log again, though I believe it is the same as before.** `[Sat Dec 05 19:14:33.295874 2020] [wsgi:error] [pid 14158:tid 140577510795008] [client 192.168.1.8:34766] Traceback (most recent call last):` `[Sat Dec 05 19:14:33.295993 2020] [wsgi:error] [pid 14158:tid 140577510795008] [client 192.168.1.8:34766] File "/opt/papermerge/config/wsgi.py", line 3, in <module>` `[Sat Dec 05 19:14:33.296015 2020] [wsgi:error] [pid 14158:tid 140577510795008] [client 192.168.1.8:34766] from django.core.wsgi import get_wsgi_application` `[Sat Dec 05 19:14:33.296069 2020] [wsgi:error] [pid 14158:tid 140577510795008] [client 192.168.1.8:34766] ModuleNotFoundError: No module named 'django'` `[Sat Dec 05 19:14:33.630112 2020] [wsgi:error] [pid 14159:tid 140577544365824] [client 192.168.1.8:34767] mod_wsgi (pid=14159): Failed to exec Python script file '/opt/papermerge/config/wsgi.py'., referer: http://****:8060/` `[Sat Dec 05 19:14:33.630205 2020] [wsgi:error] [pid 14159:tid 140577544365824] [client 192.168.1.8:34767] mod_wsgi (pid=14159): Exception occurred processing WSGI script '/opt/papermerge/config/wsgi.py'., referer: http://****:8060/` `[Sat Dec 05 19:14:33.643991 2020] [wsgi:error] [pid 14159:tid 140577544365824] [client 192.168.1.8:34767] Traceback (most recent call last):, referer: http://****:8060/`
Author
Owner

@doughnet commented on GitHub (Feb 5, 2021):

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

this worked perfect.

there are lots of issues with the documentation having the incorrect information unfortunately. wasted lots of time trying to figure this out.

<!-- gh-comment-id:774244558 --> @doughnet commented on GitHub (Feb 5, 2021): > 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 this worked perfect. there are lots of issues with the documentation having the incorrect information unfortunately. wasted lots of time trying to figure this out.
Author
Owner

@nblracer880 commented on GitHub (Feb 5, 2021):

Wow, thank you so much!! I had pretty much given up on this at this point. I'll give it a shot this weekend!

<!-- gh-comment-id:774245369 --> @nblracer880 commented on GitHub (Feb 5, 2021): Wow, thank you so much!! I had pretty much given up on this at this point. I'll give it a shot this weekend!
Author
Owner

@pascalspits commented on GitHub (Feb 12, 2021):

all went well following your tutorial, but I get a "database read-only error" when testing :

I created a VM with Ubuntu 20.04.1LTS

from the beginning I did "sudo -i" to do the whole tutorial as root ...

apache gives this error :

http://192.168.1.86:8060/accounts/login/?next=/

OperationalError at /accounts/login/
attempt to write a readonly database
Request Method:	GET
Request URL:	http://192.168.1.86:8060/accounts/login/?next=/
Django Version:	3.0.10
Exception Type:	OperationalError
Exception Value:	
attempt to write a readonly database
Exception Location:	/opt/papermerge/.venv/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py in execute, line 396
Python Executable:	/opt/papermerge/.venv//bin/python
Python Version:	3.8.5
Python Path:	
['/',
 '/opt/papermerge',
 '/usr/lib/python38.zip',
 '/usr/lib/python3.8',
 '/usr/lib/python3.8/lib-dynload',
 '/opt/papermerge/.venv/lib/python3.8/site-packages',
 '/usr/local/lib/python3.8/dist-packages',
 '/usr/lib/python3/dist-packages']
Server time:	Fri, 12 Feb 2021 11:33:24 +0000

the "papermerge.conf" file looks like this :

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

 ServerName 192.168.1.86
    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/

what did I do wrong ?

something to do with permissions maybe ?

thanks in advance for helping

Pascal

<!-- gh-comment-id:778146520 --> @pascalspits commented on GitHub (Feb 12, 2021): all went well following your tutorial, but I get a "database read-only error" when testing : I created a VM with Ubuntu 20.04.1LTS from the beginning I did "sudo -i" to do the whole tutorial as root ... apache gives this error : http://192.168.1.86:8060/accounts/login/?next=/ ``` OperationalError at /accounts/login/ attempt to write a readonly database Request Method: GET Request URL: http://192.168.1.86:8060/accounts/login/?next=/ Django Version: 3.0.10 Exception Type: OperationalError Exception Value: attempt to write a readonly database Exception Location: /opt/papermerge/.venv/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py in execute, line 396 Python Executable: /opt/papermerge/.venv//bin/python Python Version: 3.8.5 Python Path: ['/', '/opt/papermerge', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/opt/papermerge/.venv/lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages'] Server time: Fri, 12 Feb 2021 11:33:24 +0000 ``` the "papermerge.conf" file looks like this : ``` <VirtualHost *:8060> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined ServerName 192.168.1.86 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/ ``` what did I do wrong ? something to do with permissions maybe ? thanks in advance for helping Pascal
Author
Owner

@nblracer880 commented on GitHub (Mar 8, 2021):

Yes, I am also getting the same thing when testing.

`

Request Method: GET
http://URL:8060/accounts/login/?next=/
3.0.10
OperationalError
attempt to write a readonly database
/usr/local/lib/python3.8/dist-packages/django/db/backends/sqlite3/base.py in execute, line 396
/opt/papermerge/.venv//bin/python
3.8.5
['/', '/opt/papermerge', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/opt/papermerge/.venv/lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages']
Mon, 8 Mar 2021 01:34:21 +0000

`

<!-- gh-comment-id:792403373 --> @nblracer880 commented on GitHub (Mar 8, 2021): Yes, I am also getting the same thing when testing. ` Request Method: | GET -- | -- http://URL:8060/accounts/login/?next=/ 3.0.10 OperationalError attempt to write a readonly database /usr/local/lib/python3.8/dist-packages/django/db/backends/sqlite3/base.py in execute, line 396 /opt/papermerge/.venv//bin/python 3.8.5 ['/', '/opt/papermerge', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/opt/papermerge/.venv/lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages'] Mon, 8 Mar 2021 01:34:21 +0000 `
Author
Owner

@new0ne commented on GitHub (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

<!-- gh-comment-id:880605450 --> @new0ne commented on GitHub (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
Author
Owner

@GBozkir commented on GitHub (Aug 17, 2021):

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

Excellent tutorial! How is it with version 2.0.1 of Papermerge ? Did try to setup with the same tutorial but some features are not working so good. Like multiple upload and deleting documents etc.

Some error logs from console:

Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
send http://10.0.0.21:8060/static/admin/js/papermerge.js:72
papermerge.js:72:14464
send http://10.0.0.21:8060/static/admin/js/papermerge.js:72

Apache2 Logs:

[Tue Aug 17 12:46:51.985065 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] return executor(sql, params, many, context), referer: http://10.0.0.21:8060/admin/browse
[Tue Aug 17 12:46:51.985067 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] File "/opt/papermerge/.venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute, referer: http://10.0.0.21:8060/admin/browse
[Tue Aug 17 12:46:51.985069 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] return self.cursor.execute(sql, params), referer: http://10.0.0.21:8060/admin/browse
[Tue Aug 17 12:46:51.985071 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] File "/opt/papermerge/.venv/lib/python3.8/site-packages/django/db/utils.py", line 90, in exit, referer: http://10.0.0.21:8060/admin/browse
[Tue Aug 17 12:46:51.985073 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] raise dj_exc_value.with_traceback(traceback) from exc_value, referer: http://10.0.0.21:8060/admin/browse
[Tue Aug 17 12:46:51.985076 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] File "/opt/papermerge/.venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute, referer: http://10.0.0.21:8060/admin/browse
[Tue Aug 17 12:46:51.985078 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] return self.cursor.execute(sql, params), referer: http://10.0.0.21:8060/admin/browse
[Tue Aug 17 12:46:51.985080 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] File "/opt/papermerge/.venv/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute, referer: http://10.0.0.21:8060/admin/browse
[Tue Aug 17 12:46:51.985082 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] return Database.Cursor.execute(self, query, params), referer: http://10.0.0.21:8060/admin/browse
[Tue Aug 17 12:46:51.985084 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] django.db.utils.OperationalError: database is locked, referer: http://10.0.0.21:8060/admin/browse

<!-- gh-comment-id:900177938 --> @GBozkir commented on GitHub (Aug 17, 2021): > > > 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 Excellent tutorial! How is it with version 2.0.1 of Papermerge ? Did try to setup with the same tutorial but some features are not working so good. Like multiple upload and deleting documents etc. Some error logs from console: Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data send http://10.0.0.21:8060/static/admin/js/papermerge.js:72 papermerge.js:72:14464 send http://10.0.0.21:8060/static/admin/js/papermerge.js:72 Apache2 Logs: [Tue Aug 17 12:46:51.985065 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] return executor(sql, params, many, context), referer: http://10.0.0.21:8060/admin/browse [Tue Aug 17 12:46:51.985067 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] File "/opt/papermerge/.venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute, referer: http://10.0.0.21:8060/admin/browse [Tue Aug 17 12:46:51.985069 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] return self.cursor.execute(sql, params), referer: http://10.0.0.21:8060/admin/browse [Tue Aug 17 12:46:51.985071 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] File "/opt/papermerge/.venv/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__, referer: http://10.0.0.21:8060/admin/browse [Tue Aug 17 12:46:51.985073 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] raise dj_exc_value.with_traceback(traceback) from exc_value, referer: http://10.0.0.21:8060/admin/browse [Tue Aug 17 12:46:51.985076 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] File "/opt/papermerge/.venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute, referer: http://10.0.0.21:8060/admin/browse [Tue Aug 17 12:46:51.985078 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] return self.cursor.execute(sql, params), referer: http://10.0.0.21:8060/admin/browse [Tue Aug 17 12:46:51.985080 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] File "/opt/papermerge/.venv/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute, referer: http://10.0.0.21:8060/admin/browse [Tue Aug 17 12:46:51.985082 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] return Database.Cursor.execute(self, query, params), referer: http://10.0.0.21:8060/admin/browse [Tue Aug 17 12:46:51.985084 2021] [wsgi:error] [pid 13391:tid 140397726906112] [client 10.0.1.2:57328] django.db.utils.OperationalError: database is locked, referer: http://10.0.0.21:8060/admin/browse
Author
Owner

@tnichlanikh commented on GitHub (Mar 20, 2023):

I just cant get papermerge and apache2 to work! keep getting the - attempt to write readonly database error. I have copied the conf file into my /etc/apache2 folder as well. Can someone please help!

<!-- gh-comment-id:1476362620 --> @tnichlanikh commented on GitHub (Mar 20, 2023): I just cant get papermerge and apache2 to work! keep getting the - attempt to write readonly database error. I have copied the conf file into my /etc/apache2 folder as well. Can someone please help!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/papermerge#187
No description provided.