Django and requirements
<p>Im a bit stuck.  I can't get this configuration to work and I don't know why.  The code I site below is from <a href="https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-14-04" rel="nofollow">https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-14-04</a>.  The reason I get stuck on it is because he named his project directory and his project the same thing.  If I am right, then where he is locating files like the settings.py and wsgi.py should be /home/user/myproject/myproject/myproject but I'm not sure anymore because I can't even get it right myself.  Earlier in the document he cd's into the directory he created, which would put him in /home/user/myproject.  He then proceeds to create a virtual environment, enter it, and run <code>django-admin startproject myproject</code>.  So, if all this holds true, at least what I see on my own server tells me that when you start a django project it actually creates two folders with the same name, nested.  Am I wrong?  Can someone help me straighten the below code out to make more sense?</p>

<p>
        . . .</p>

<pre><code>    Alias /static /home/user/myproject/static
    &lt;Directory /home/user/myproject/static&gt;
        Require all granted
    &lt;/Directory&gt;

    &lt;Directory /home/user/myproject/myproject&gt;
        &lt;Files wsgi.py&gt;
            Require all granted
        &lt;/Files&gt;
    &lt;/Directory&gt;

    WSGIDaemonProcess myproject python-path=/home/user/myproject:/home/user/myproject/myprojectenv/lib/python2.7/site-packages
    WSGIProcessGroup myproject
    WSGIScriptAlias / /home/user/myproject/myproject/wsgi.py

&lt;/VirtualHost&gt;
</code></pre>

<p>This is what I consistently see in my apache log:</p>

<pre><code>[Sun Oct 09 11:48:15.875313 2016] [wsgi:warn] [pid 47964] mod_wsgi: Compiled for Python/3.5.1+.
[Sun Oct 09 11:48:15.875353 2016] [wsgi:warn] [pid 47964] mod_wsgi: Runtime using Python/3.5.2.
[Sun Oct 09 11:48:15.877537 2016] [mpm_prefork:notice] [pid 47964] AH00163: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/3.5.2 configured -- resuming normal operations
[Sun Oct 09 11:48:15.877568 2016] [core:notice] [pid 47964] AH00094: Command line: '/usr/sbin/apache2'
[Sun Oct 09 11:48:18.767800 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662] mod_wsgi (pid=47967): Target WSGI script '/home/addohm/projects/rtservice/servicesite/servicesite/wsgi.py' cannot be loaded as Python module.
[Sun Oct 09 11:48:18.767851 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662] mod_wsgi (pid=47967): Exception occurred processing WSGI script '/home/addohm/projects/rtservice/servicesite/servicesite/wsgi.py'.
[Sun Oct 09 11:48:18.768339 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662] Traceback (most recent call last):
[Sun Oct 09 11:48:18.768385 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "/home/addohm/projects/rtservice/servicesite/servicesite/wsgi.py", line 16, in &lt;module&gt;
[Sun Oct 09 11:48:18.768389 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]     application = get_wsgi_application()
[Sun Oct 09 11:48:18.768395 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "/usr/lib/python3/dist-packages/django/core/wsgi.py", line 14, in get_wsgi_application
[Sun Oct 09 11:48:18.768398 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]     django.setup()
[Sun Oct 09 11:48:18.768405 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "/usr/lib/python3/dist-packages/django/__init__.py", line 17, in setup
[Sun Oct 09 11:48:18.768408 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Sun Oct 09 11:48:18.768413 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 48, in __getattr__
[Sun Oct 09 11:48:18.768423 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]     self._setup(name)
[Sun Oct 09 11:48:18.768430 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 44, in _setup
[Sun Oct 09 11:48:18.768433 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]     self._wrapped = Settings(settings_module)
[Sun Oct 09 11:48:18.768438 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 92, in __init__
[Sun Oct 09 11:48:18.768441 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]     mod = importlib.import_module(self.SETTINGS_MODULE)
[Sun Oct 09 11:48:18.768446 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
[Sun Oct 09 11:48:18.768449 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]     return _bootstrap._gcd_import(name[level:], package, level)
[Sun Oct 09 11:48:18.768454 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "&lt;frozen importlib._bootstrap&gt;", line 986, in _gcd_import
[Sun Oct 09 11:48:18.768460 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load
[Sun Oct 09 11:48:18.768466 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "&lt;frozen importlib._bootstrap&gt;", line 944, in _find_and_load_unlocked
[Sun Oct 09 11:48:18.768471 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "&lt;frozen importlib._bootstrap&gt;", line 222, in _call_with_frames_removed
[Sun Oct 09 11:48:18.768477 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "&lt;frozen importlib._bootstrap&gt;", line 986, in _gcd_import
[Sun Oct 09 11:48:18.768483 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load
[Sun Oct 09 11:48:18.768488 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662]   File "&lt;frozen importlib._bootstrap&gt;", line 956, in _find_and_load_unlocked
[Sun Oct 09 11:48:18.768505 2016] [wsgi:error] [pid 47967] [remote 192.168.2.249:22662] ImportError: No module named 'servicesite'
</code></pre>

<p>in your /etc/apache2/apache2.conf file add </p>

<pre><code>&lt;Directory /home/dimitris/mysite&gt;
    AllowOverride All
    Require all granted
&lt;/Directory&gt;
</code></pre>

<p>your site.conf file  in the example i load mysite with virtualenv</p>

<pre><code>WSGIDaemonProcess myp user=dimitris group=dimitris threads=5  python-path=/home/dimitris/myenv/lib/python2.7/site-packages

&lt;VirtualHost *:80&gt;
    #ServerName mysite
    #ServerAlias mysite
    ServerAdmin webmaster@localhost
    WSGIProcessGroup myp
    WSGIScriptAlias / /home/dimitris/mysite/mysite/wsgi.py

    Alias /favicon.ico /home/dimitris/mysite/favicon.ico
    Alias /media/ /home/dimitris/mysite/media/
    Alias /static/ /home/dimitris/mysite/project-static/
    DocumentRoot /home/dimitris/mysite
    &lt;Directory /home/dimitris/mysite/&gt;
            Order allow,deny
            allow from all
    &lt;/Directory&gt;
    LogFormat "%h %l %u %t \"%r\" %&gt;s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
    ErrorLog /var/log/mysite-error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
    CustomLog /var/log/mysite-access.log combined
&lt;/VirtualHost&gt;
</code></pre>

<p>in django wsgi.py file add</p>

<pre><code>import os
DJANGO_PATH =  os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
sys.path.append(DJANGO_PATH)
</code></pre>

<p>in the above code replace dimitris with your username</p>

python django apache mod-wsgi