Reputation: 1
I have python 3.7 installed with mod_Wsgi and Apache2.4. A simple website works on the server but when I try to import my own python modules or other modules like numpy the server just hangs and never fully loads.
I tried looking at windows event logger and logs in my apache file but there was nothing there that said there was any problems. I also tried sys.path.append(path) before each library but that didn't work.
This is an example code that I'm using to test why the server doesn't work when I import other libraries. I already did "pip install numpy"
web.wsgi file:
import numpy as np
import sys
sys.path.append('C:/myapp/app/')
from app import app as application
app.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
a = np.arrange(12).reshape(2,2,3)
return "f"
if __name=="__main__"
app.run()
Upvotes: 0
Views: 1066
Reputation: 1934
I am not much familiar with the environment you have, however, I suggest you check the location of the "site_packages" and make sure that the pip is installing in the same path of the "site_packages" that you are mainly using to install your packages. Also, you may consider creating a Python virtual environment in which you install all your packages in and ensure that it is activated while executing your code.
Upvotes: 1