0

I have a Flask Project structure directory inside /var/www:

item-catalog-fullstacknd\
    itemCatalogApp.wsgi
    itemCatalogApp\
        __init__.py

This is th WSGI file above:

import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/item-catalog-fullstacknd/")
from itemCatalogApp import app as application
application.secret_key = 'Add your secret key' 

This is the /etc/apache2/sites-enabled/000-default.conf

WSGIPythonPath /var/www/item-catalog-fullstacknd/itemCatalogApp/
<VirtualHost *:80>
    WSGIScriptAlias / /var/www/item-catalog-fullstacknd/itemCatalogApp.wsgi

            <Directory /var/www/item-catalog-fullstacknd/itemCatalogApp>
                    Order allow,deny
                    Allow from all
            </Directory>

            Alias /static /var/www/item-catalog-fullstacknd/itemCatalogApp/static

            <Directory /var/www/item-catalog-fullstacknd/itemCatalogApp/static/>
                    Order allow,deny
                    Allow from all
            </Directory>

</VirtualHost>

And I am getting the following error:

mod_wsgi (pid=17586): Exception occurred processing WSGI script '/var/www/item-catalog-fullstacknd/itemCatalogApp.wsgi'.
 Traceback (most recent call last):
   File "/var/www/item-catalog-fullstacknd/itemCatalogApp.wsgi", line 6, in <module>
     from itemCatalogApp import app as application
   File "/var/www/item-catalog-fullstacknd/itemCatalogApp/__init__.py", line 3, in <module>
     from flask import Flask, jsonify, render_template, request
 ImportError: No module named flask

I already pip install all the modules contained in the requirements.txt file. I have no idea what to do anymore.

1 Answer 1

1

It's possible that you've installed modules for a different python executable, not the one that your mod_wsgi uses by default. To check that, add to the beggining of your WSGI file:

import sys
print(sys.executable)

Then, open shell, run a python and type the same code there. If path is different, you should specify WSGIPythonHome to point at the desired python executable.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.