Hi Graham, thank you very much for your comments and recommendations. 

1. I do not have  AppArmor enabled - at least I am not aware of
2. I have checked my installation implementing the suggested test 
applicationn "myapp" described here 
<https://modwsgi.readthedocs.io/en/master/user-guides/quick-configuration-guide.html>
 - 
it worked fine. So the installation seems to be ok. 
3. I haven't  found the file *mod_wsgi.so* neither with LD_LIBRARY_PATH set 
nor without. So I run *mod_wsgi-express module-config *and received this 
answer:
LoadModule wsgi_module 
"/home/hfwds/.local/lib/python3.10/site-packages/mod_wsgi/server/mod_wsgi-py310.cpython-310-x86_64-linux-gnu.so"
WSGIPythonHome "/usr"
what bothers my is that the pyhton home is /user - actually I found 
python3.10 here: */usr/local/lib/python3.10 *but the wsgi_module seem to be 
under */home/hfwds/.local/lib/python3.10/*
I seem to have 2 different python3.10 installations. Might this be a 
problem? BTW: the one under /usr/ is the latest. 
4. I checked your recommendation with the virtual environments. Actually it 
seems that I do not necessarily need a virtual environment as I do not plan 
to have "multiple distinct Python environments for the same version of 
Python," as described here 
<https://modwsgi.readthedocs.io/en/master/user-guides/virtual-environments.html>
. 
So I just want to run one python application that start with __init__.py 
load view.py that holds the logic runing a flask python project installed 
here.  
[image: server_installation.png]
I still struggeling how the wsgi file would look like to  start this. Any 
recommendation: Thank you again in advance. 
Kind regard from Germany 
Harald 

Harald Fontius schrieb am Sonntag, 16. April 2023 um 22:50:42 UTC+2:

> I am trying to run a PYTHON FLASK application created in MS Visual Studio 
> and exported it to a directory call “conjugationgame”. 
>
> In the VISUAL STUDIO environment it runs without problems. Now I want to 
> install it on a LINUX Server hosted by IONOS. 
>
> UBUNTU  22.04.2 LTS (GNU/Linux 5.15.0-69-generic x86_64) is installed. 
> Apache2 is installed and shows this status:
>
> apache2.service - The Apache HTTP Server
>      Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor 
> preset: enabled)
>      Active: active (running) since Wed 2023-04-12 15:58:48 UTC; 1 day 23h 
> ago
>        Docs: https://httpd.apache.org/docs/2.4/
>    Main PID: 15997 (apache2)
>       Tasks: 71 (limit: 2193)
>      Memory: 30.1M
>         CPU: 55.237s
>      CGroup: /system.slice/apache2.service
>              ├─15997 /usr/sbin/apache2 -k start
>              ├─75728 /usr/sbin/apache2 -k start
>              ├─75729 /usr/sbin/apache2 -k start
>              ├─75730 /usr/sbin/apache2 -k start
>              └─75731 /usr/sbin/apache2 -k start
>
> I tried to install a mod_wsgi virtual environment following @Luke Peter’s 
> very good video tutorial (183) How to Deploy a Flask App to Linux (Apache 
> and WSGI) - YouTube <https://www.youtube.com/watch?v=w0QDAg85Oow>
>
> In installed the application like this:
>
> [image: server_installation.png]
>
> I run pipenv install according to this answer to a problem with  
> mutablemapping python - AttributeError: module 'collections' has no 
> attribute 'MutableMapping' - Stack Overflow 
> <https://stackoverflow.com/questions/70943244/attributeerror-module-collections-has-no-attribute-mutablemapping>
>
> [image: install pipenv.png] 
>
> Although I got an error running  *pipenv install* after changing the 
> directory to var/www/conjugationgame.de/conjugationgame/*:*
>
> [image: Permission_error_pipenv install.png]
>
> Hard to read:
>
> PermissionError: [Errno 13] Permission denied ‘var/www/
> conjugationgame.de/conjugationgame/._atomic-writelcmrxftk’ (might be the 
> problem but I couldn’t find anything to solve it)
>
> *pipenv –venv* gives the link to the virtual environment:
>
> [image: error_venv.png]
>
> With this link I created the wsgi file like this:
>
> [image: wsgi.png]
>
> and the config file like this 
>
> [image: config.png]
>
> Checked the syntax of the config and restarted apache2.
>
> [image: restart config.png]
>
> When calling https://conjugationgame.de I get this error: 
>
> [Fri Apr 14 15:18:59.616298 2023] [wsgi:error] [pid 75730:tid 
> 139907032913472] [client 91.23.91.105:56927] mod_wsgi (pid=75730): Failed 
> to exec Python script file '/var/www/conjugationgame.de/__init__.wsgi'., 
> referer: https://conjugationgame.de/
>
> [Fri Apr 14 15:18:59.616378 2023] [wsgi:error] [pid 75730:tid 
> 139907032913472] [client 91.23.91.105:56927] mod_wsgi (pid=75730): 
> Exception occurred processing WSGI script '/var/www/
> conjugationgame.de/__init__.wsgi'., referer: https://conjugationgame.de/
>
> [Fri Apr 14 15:18:59.616487 2023] [wsgi:error] [pid 75730:tid 
> 139907032913472] [client 91.23.91.105:56927] Traceback (most recent call 
> last):, referer: https://conjugationgame.de/
>
> [Fri Apr 14 15:18:59.616514 2023] [wsgi:error] [pid 75730:tid 
> 139907032913472] [client 91.23.91.105:56927]   File "/var/www/
> conjugationgame.de/__init__.wsgi", line 4, in <module>, referer: 
> https://conjugationgame.de/
>
> [Fri Apr 14 15:18:59.616520 2023] [wsgi:error] [pid 75730:tid 
> 139907032913472] [client 91.23.91.105:56927]     with open(activate_this) 
> as file_:, referer: https://conjugationgame.de/
>
> [Fri Apr 14 15:18:59.616569 2023] [wsgi:error] [pid 75730:tid 
> 139907032913472] [client 91.23.91.105:56927] PermissionError: [Errno 13] 
> Permission denied: 
> '/home/hfwds/.local/share/virtualenvs/conjugationgame-4RgIZZXj/bin/activate_this.py',
>  
> referer: https://conjugationgame.de/
>
> The activate file looks like this:
>
>
> I tried whatever I could find – without success. Can anybody help?
>
> I also tried user www-data and group www-data in the config file – same 
> problem. I solved the problem before following the answer in this question:
>
> python - Apache/Django/mod_wsgi - [Errno 13] Permission denied: - Stack 
> Overflow 
> <https://stackoverflow.com/questions/53857711/apache-django-mod-wsgi-errno-13-permission-denied>
>
>  [image: activatefile.png]
>
> but I had to reinstall the application again and now the error is 
> permanent. 
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/bae0a81b-6f2d-47c2-8715-0f477b9b7ed0n%40googlegroups.com.

Reply via email to