almost a beginner
almost a beginner

Reputation: 1632

Setting up Django with mod_wsgi (Apache2)

ServerName test.test.nz

    ServerAdmin webmaster@localhost
    DocumentRoot /home/aut/sampleapp


    WSGIScriptAlias /home/aut/sampleapp /home/aut/sampleapp/sampleapp/wsgi.py
    WSGIPythonPath /home/aut/sampleapp:/home/aut/sampleapp/env/lib/python2.7/site-packages

    <Directory /home/aut/sampleapp>
            AllowOverride None
            Options +FollowSymLinks
            Order allow,deny
            Allow from all
            Require all granted
    </Directory>

    <Directory /home/aut/sampleapp/sampleapp>
    <Files wsgi.py>
            Require all granted
    </Files>
    </Directory>

The above is the configuration for virtual host port 80. After restarting Apache, I got no errors, but when I go to test.test.nz, I get:

The requested URL / was not found on this server.

"/home/aut/sampleapp/" is where manage.py is, within that directory, there is another folder called "sampleapp" which contains the urls.py, wsgi.py etc..

The urls.py has been edited to set the app as the index page:

from django.conf.urls import url
from django.contrib import admin
from django.contrib.sitemaps import views

urlpatterns = [
    url(r'^$', views.index, name='index'),
    url(r'^admin/', admin.site.urls),
]

What seems to be the problem?

Any help or direction would be appreciated.

Thanks in advance,

Upvotes: 0

Views: 49

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599450

You haven't defined anything for the root path, /. Your wsgiscriptalias is set to "/home/aut/sampleapp" so only applies to paths under that.

I'm not quite sure why you've done this; if you want wsgi to serve your site at the root, as you usually would, you should put / there.

Upvotes: 1

Related Questions