Apache virtualenv and mod_wsgi : ImportError : No module named 'django'
<p>I'm having issues running django and apache2/mod_wsgi. This is my current setup:</p>

<pre><code>Ubuntu: 16.0
Apache: 2.4.18
Python: 3.5
Django: 1.10
</code></pre>

<p>I have installed a virtualenv inside my django project for user 'carma'. Structure is:</p>

<pre><code>/home/carma/mycarma
|- manage.py
static
mycarma
    |__init__.py
    |settings.py
    |urls.py
    |wsgi.py
mycarmanev
    bin
    include
    lib
</code></pre>

<p>This is the content of <strong>/etc/apache2/sites-available/000-default.conf</strong></p>

<pre><code>&lt;VirtualHost *:80&gt;
    Alias /static /home/carma/mycarma/static
    &lt;Directory /home/carma/mycarma/static&gt;
            Require all granted
    &lt;/Directory&gt;
    &lt;Directory /home/carma/mycarma/mycarma&gt;
            &lt;Files wsgi.py&gt;
                    Require all granted
            &lt;/Files&gt;
    &lt;/Directory&gt;

    WSGIDaemonProcess mycarma python-path=/home/carma/mycarma/ python-home=/home/carma/mycarma/mycarmavirtuale$
    WSGIProcessGroup mycarma
    WSGIScriptAlias / /home/carma/mycarma/mycarma/wsgi.py
</code></pre>

<p></p>

<p>This is the content of <strong>wsgi.py</strong></p>

<pre><code>import os,sys
from django.core.wsgi import get_wsgi_application
DJANGO_PATH =  os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
sys.path.append(DJANGO_PATH)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mycarma.settings")

application = get_wsgi_application()
</code></pre>

<p>And I have already given permissions:</p>

<pre><code>sudo chown -R www-data:www-data /home/carma/mycarma/mycarmaenv
sudo chown -R www-data:www-data /home/carma/mycarma
</code></pre>

<p>The problem comes when I try to access the url of my server, checking the apache log this is the issue:</p>

<pre><code>[wsgi:error] [pid 25183] mod_wsgi (pid=25183): Target WSGI script '/home/carma/mycarma/mycarma/wsgi.py' cannot be loaded as Python module.
[wsgi:error] [pid 25183] mod_wsgi (pid=25183): Exception occurred processing WSGI script '/home/carma/mycarma/mycarma/wsgi.py'.
[wsgi:error] [pid 25183] Traceback (most recent call last):
[wsgi:error] [pid 25183] File "/home/carma/mycarma/mycarma/wsgi.py", line 12, in &lt;module&gt;
[wsgi:error] [pid 25183] from django.core.wsgi import get_wsgi_application
[wsgi:error] [pid 25183] ImportError: No module named 'django'
</code></pre>

<p>I have read all the possible discussions here and outside, found also <a href="http://stackoverflow.com/questions/38756969/apache-with-virtualenv-and-mod-wsgi-importerror-no-module-named-django">this thread</a> which expose exactly the same problem but nothing worked for me.</p>

<p>Any help is appreciated thanks!</p>

<p>I think it is a typo, <code>mycarmanev</code> or <code>mycarmavirtuanev</code> ?</p>

<pre><code>WSGIDaemonProcess mycarma python-path=/home/carma/mycarma/ python-home=/home/carma/mycarma/myprojectenv
</code></pre>

python django apache mod-wsgi