Jump to content

[Solved] Configuring WSGIApplicationGroup


karvp

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

[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
Link to comment
Share on other sites

  • Krydos changed the title to [Solved] Configuring WSGIApplicationGroup

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...