title: Target WSGI script cannot be loaded as Python module + ImportError: No module named
body: <p>I am having a an error while using mod_wsgi to deploy my flask app. This is the error log:</p>
  
  <pre><code>[Sat Feb 10 01:58:24.785611 2018] [wsgi:error] [pid 17184:tid 140591748056832] [remote 41.36.31.164:45065] mod_wsgi (pid=17184): Target WSGI script '/var/www/itemcatalog/itemcatalog.wsgi' cannot be loaded as Python module.
  [Sat Feb 10 01:58:24.785635 2018] [wsgi:error] [pid 17184:tid 140591748056832] [remote 41.36.31.164:45065] mod_wsgi (pid=17184): Exception occurred processing WSGI script '/var/www/itemcatalog/itemcatalog.wsgi'.
  [Sat Feb 10 01:58:24.785649 2018] [wsgi:error] [pid 17184:tid 140591748056832] [remote 41.36.31.164:45065] Traceback (most recent call last):
  [Sat Feb 10 01:58:24.785664 2018] [wsgi:error] [pid 17184:tid 140591748056832] [remote 41.36.31.164:45065]   File "/var/www/itemcatalog/itemcatalog.wsgi", line 6, in &lt;module&gt;
  [Sat Feb 10 01:58:24.785710 2018] [wsgi:error] [pid 17184:tid 140591748056832] [remote 41.36.31.164:45065]     from itemcatalog import app as application
  [Sat Feb 10 01:58:24.785729 2018] [wsgi:error] [pid 17184:tid 140591748056832] [remote 41.36.31.164:45065] ImportError: No module named itemcatalog
  </code></pre>
  
  <p>I have an <strong>init</strong>.py file inside itemcatalog directory, I did some search and found that maybe that python doesn't identify my itemcatalog as a package, what is the reason for this?</p>
  
  <p>Python was installed globally but then I also tried to also install it inside a virtual environment. </p>
  
  <p>This is the code for the virtual host:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
              ServerName 18.194.244.229
              ServerAdmin admin@18.194.244.229
              WSGIDaemonProcess itemcatalog python-path=/var/www/itemcatalog:/var/www/itemcatalog/venv/lib/python2.7/site-packages
              WSGIProcessGroup itemcatalog
              WSGIScriptAlias / /var/www/itemcatalog/itemcatalog.wsgi
  
              &lt;Directory /var/www/itemcatalog/&gt;
                  WSGIApplicationGroup %{GLOBAL}
                  Order deny,allow
                  Allow from all
               &lt;/Directory&gt;
  
              ErrorLog ${APACHE_LOG_DIR}/error.log
              LogLevel warn
              CustomLog ${APACHE_LOG_DIR}/access.log combined
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>And this is the file structure inside <code>/var/www/itemcatalog/</code></p>
  
  <p><a href="https://i.stack.imgur.com/ytKKi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ytKKi.png" alt="enter image description here"></a></p>