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
In installed the application like this:
I run pipenv install according to this answer to a problem with mutablemapping python - AttributeError: module 'collections' has no attribute 'MutableMapping' - Stack Overflow
Although I got an error running pipenv install after changing the directory to var/www/conjugationgame.de/conjugationgame/:
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:
With this link I created the wsgi file like this:
and the config file like this
Checked the syntax of the config and restarted apache2.
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
but I had to reinstall the application again and now the error is permanent.
On 16 Apr 2023, at 10:08 pm, Harald Fontius <ted...@gmx.net> wrote:
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 startI 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
In installed the application like this:
<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
<install pipenv.png>
Although I got an error running pipenv install after changing the directory to var/www/conjugationgame.de/conjugationgame/:
<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:
<error_venv.png>
With this link I created the wsgi file like this:
<wsgi.png>
and the config file like this
<config.png>
Checked the syntax of the config and restarted apache2.
<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
<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 modwsgi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/af11814c-bee5-49ed-9af2-1d8a6fb8c438n%40googlegroups.com.
<config.png><server_installation.png><restart config.png><error_venv.png><wsgi.png><activatefile.png><Permission_error_pipenv install.png><install pipenv.png>
On 18 Apr 2023, at 1:09 am, Harald Fontius <ted...@gmx.net> wrote:
Now I removed the virtual environment and change wsgi-file to this:
--
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 modwsgi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/9e63aac0-6616-4bb5-86a9-8258c00fa5c9n%40googlegroups.com.
<Screenshot 2023-04-17 170647.png>
Thank you very much – yes that was the problem. It works now.
Kind Regards Harald