mirror of
https://github.com/ciur/papermerge.git
synced 2026-04-25 12:05:58 +03:00
[GH-ISSUE #236] Having trouble getting papermerge to run in apache2 #187
Labels
No labels
2.1
3.0
3.0.1
3.0.2
3.0.3
3.0.3
3.1
3.2
3.2
3.3
3.5
3.x
Fixed. Waiting for feedback.
Fixed. Waiting for feedback.
UX
Version 2.1 - alpha
XSS
announcement
beta
blocker
bug
cannot reproduce
confirmed
confirmed
critical
demo
dependencies
deployment
detchnical debt
discussion
docker
documentation
donations
duplicate
enhancement
feature request
frontend
fundraising
good first issue
good issue
help wanted
high
implemented
important
improvement
incomplete
invalid
investigation
kubernetes
low
low impact
medium
medium
medium impact
migration from 2.0
migration from 2.1
missing-language
missing-ocr-language
no-activity
note
ocr
outofscope
packaging
performance
popular request
pull-request
pypi
question
raspberry pi
roadmap
search
security
setup
status
task
technical debt
updates
user xp
version 1.4.0 - demo
will be implemented
will not be implemented
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/papermerge#187
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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'@jorisvc commented on GitHub (Dec 2, 2020):
Can you check if django is installed?
Go to the papermerge directory, for me this is
/opt/papermergeActivate the virtual environment with command
source .venv/bin/activateCheck if Django is installed with command
pip show djangoIf it is missing you should install the Papermerge necessary dependencies with command
pip3 install -r requirements/base.txt@nblracer880 commented on GitHub (Dec 2, 2020):
It appears to be installed. Papermerge runs just fine when I run
./manage.py runserverand./manage.py workerGetting 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@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.
@nblracer880 commented on GitHub (Dec 2, 2020):
I'm on Ubuntu 20.04.1 LTS
@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 -yClone
git clone --branch v1.5.0 https://github.com/ciur/papermerge.git /opt/papermergeinstall SUDO
apt install sudo -yinstall dependencies
Prepare python virtual environment
Activate it
source .venv/bin/activateInstall dependencies
pip3 install -r requirements/base.txt./manage.py migrate./manage.py createsuperuserCopy example configuration file to /etc
cp /opt/papermerge/papermerge.conf.py.example /etc/papermerge.conf.pyPermissions for Apache
chown www-data:www-data /etc/papermerge.conf.pychmod 770 /etc/papermerge.conf.pyCreate static
cd /opt/papermergesource .venv/bin/activate./manage.py collectstaticInstall APACHE
apt install apache2 -yInstall WSGI module
apt install libapache2-mod-wsgi-py3 -yCreate virtualhost for apache
vi /etc/apache2/sites-available/papermerge.confCreate 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.confAdd 1 line below Listen 80
Listen 8060Restart apache
systemctl restart apache2Test
@nblracer880 commented on GitHub (Dec 2, 2020):
Wow thank you. I will give this a shot here in the next couple of days :)
@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
WSGIScriptAlias / /opt/papermerge/config/wsgi.py
WSGIPythonHome /opt/papermerge/.venv/ WSGIPythonPath /opt/papermerge/`@jorisvc commented on GitHub (Dec 3, 2020):
Can you move WSGIScriptAlias / /opt/papermerge/config/wsgi.py above ?
Like this:
@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.logCustomLog ${APACHE_LOG_DIR}/access.log combinedServerName PaperMergeServerRoot /opt/papermergeAlias /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'@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
Create a symlink for python (i didn't had to do that in Debian)
sudo ln -s /usr/bin/python3 /usr/bin/python@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 :)
@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.txtin th venvWARNING: 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/@doughnet commented on GitHub (Feb 5, 2021):
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.
@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!
@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=/
the "papermerge.conf" file looks like this :
what did I do wrong ?
something to do with permissions maybe ?
thanks in advance for helping
Pascal
@nblracer880 commented on GitHub (Mar 8, 2021):
Yes, I am also getting the same thing when testing.
`
`
@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
@GBozkir commented on GitHub (Aug 17, 2021):
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
@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!