I am on windows, the problem is with my virtual environment. Respectfully, I want to understand where is the activate_this.py file?
It's been days now, and after resolving an array of errors, I guess or should I say, I wish, I am on my final error for my flask deployment on apache servers. Respectfully, I am curious to understand where is the activate_this.py in my virtual environment that I can use to tell my .wsgi script to execute. As, my app folder structure has only activate file under script, and similar versions for .bat .ps1. Would you be please! please! please! kind enough to tell me where am I going wrong with this, and what am I required to do. As, I suppose you would understand how frustrated I had become to actually go through all these errors, which are haulting my progress. Thank you.
Here is my .wsgi script: `#!
import sys
activate_this = "C:/xampp/htdocs/ForEx/Scripts/activate" with open(activate_this) as file_: exec(file_.read(),dict(file=activate_this))
sys.path.insert(0,'C:\xampp\htdocs\ForEx\') from app import app as application
`
Here is my error log:
'
[Sat Feb 11 00:46:42.640691 2023] [wsgi:error] [pid 5580:tid 1972] [client 127.0.0.1:60369] mod_wsgi (pid=5580): Failed to exec Python script file 'C:/xampp/htdocs/ForEx/web.wsgi'., referer: http://127.0.0.1/
[Sat Feb 11 00:46:42.640691 2023] [wsgi:error] [pid 5580:tid 1972] [client 127.0.0.1:60369] mod_wsgi (pid=5580): Exception occurred processing WSGI script 'C:/xampp/htdocs/ForEx/web.wsgi'., referer: http://127.0.0.1/
[Sat Feb 11 00:46:42.640691 2023] [wsgi:error] [pid 5580:tid 1972] [client 127.0.0.1:60369] Traceback (most recent call last):\r, referer: http://127.0.0.1/
[Sat Feb 11 00:46:42.640691 2023] [wsgi:error] [pid 5580:tid 1972] [client 127.0.0.1:60369] File "C:/xampp/htdocs/ForEx/web.wsgi", line 8, in
'
When activating virtual environment manually, you usually type such a command in your command prompt:
.\envname\Scripts\activate
The activate_this.py refers to that script that is being executed through this command.
refer to this
Hmmm, seems I never got notification on the original issue creation. Either way, avoid using activate_this.py. See:
- https://modwsgi.readthedocs.io/en/master/user-guides/virtual-environments.html
on recommended ways to use a virtual environment.