Jump to content

Recommended Posts

Posted

I am using python flask to run a server and currently having this issue:

ImportError: Interpreter change detected - this module can only be loaded into one interpreter per process.

So I googled about it and found that we can insert this into the .conf file

WSGIApplicationGroup %{GLOBAL}

However, I don't know how to do it here. I have tried many different ways like:

# flask.wsgi file
import os
# ...

from server import app as application

application.config["WSGIApplicationGroup"] = os.environ["GLOBAL"]

But it raised a KeyError.

How can I solve this issue? Any ideas are appreciated

Posted

Does it work now?

As an added bonus, if you make changes to your Flask app try editing flask.wsgi and see if it loads the changes immediately rather than waiting for an Apache restart. You can just add a blank line or remove a blank line or something and it should restart your Flask app. Let us know if reloading the Flask app works too.

  • Thanks 1
Posted
[Sat Apr 13 21:06:22.259951 2024] [wsgi:error] [pid 30217:tid 139907699214080] [remote 123.123.123.123:50346] mod_wsgi (pid=30217): Failed to exec Python script file '/home/ygo.helioho.st/httpdocs/flask.wsgi'.
[Sat Apr 13 21:06:22.260151 2024] [wsgi:error] [pid 30217:tid 139907699214080] [remote 123.123.123.123:50346] mod_wsgi (pid=30217): Exception occurred processing WSGI script '/home/ygo.helioho.st/httpdocs/flask.wsgi'.
[Sat Apr 13 21:06:22.268778 2024] [wsgi:error] [pid 30217:tid 139907699214080] [remote 123.123.123.123:50346] Traceback (most recent call last):
[Sat Apr 13 21:06:22.268855 2024] [wsgi:error] [pid 30217:tid 139907699214080] [remote 123.123.123.123:50346]   File "/home/ygo.helioho.st/httpdocs/flask.wsgi", line 10, in <module>
[Sat Apr 13 21:06:22.268869 2024] [wsgi:error] [pid 30217:tid 139907699214080] [remote 123.123.123.123:50346]     from server import app as application
[Sat Apr 13 21:06:22.268901 2024] [wsgi:error] [pid 30217:tid 139907699214080] [remote 123.123.123.123:50346]   File "/home/ygo.helioho.st/httpdocs/server.py", line 81
[Sat Apr 13 21:06:22.268924 2024] [wsgi:error] [pid 30217:tid 139907699214080] [remote 123.123.123.123:50346]     \t\t\t\tresult = backend.Authenticator.login(username, password, hashalgo)
[Sat Apr 13 21:06:22.268952 2024] [wsgi:error] [pid 30217:tid 139907699214080] [remote 123.123.123.123:50346]     ^

Python is really picky about spaces and tabs. One of the reasons I hate Python.

  • Like 1
  • Krydos changed the title to [Solved] Configuring WSGIApplicationGroup
  • Krydos locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...