My Django application works fine in the Django server however when I try 
using Apache, my Django application does either two things.

A:
A URL serves a directory listing : http://192.168.33.102:8787/myapp/

B: 
A URL serves:

Not Found

The requested URL /myapp/ass1v2/ was not found on this server.
------------------------------
Apache/2.2.22 (Ubuntu) Server at 192.168.33.102 Port 8787

I looked at my Apache 2 error log and notice the following. 

[Mon Jul 14 18:57:41 2014] [error] [client 192.168.33.1] File does not 
exist: 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/myapp/ass1v2
[Mon Jul 14 18:57:41 2014] [error] [client 192.168.33.1] File does not 
exist: 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/myapp/ass1v2
[Mon Jul 14 18:57:42 2014] [error] [client 192.168.33.1] File does not 
exist: 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/myapp/ass1v2
[Mon Jul 14 18:57:42 2014] [error] [client 192.168.33.1] File does not 
exist: 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/myapp/ass1v2
[Mon Jul 14 18:57:42 2014] [error] [client 192.168.33.1] File does not 
exist: 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/myapp/ass1v2
[Mon Jul 14 18:57:43 2014] [error] [client 192.168.33.1] File does not 
exist: 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/myapp/ass1v2
[Mon Jul 14 18:57:43 2014] [error] [client 192.168.33.1] File does not 
exist: 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/myapp/ass1v2
[Mon Jul 14 18:57:43 2014] [error] [client 192.168.33.1] File does not 
exist: 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/myapp/ass1v2
[Mon Jul 14 18:57:44 2014] [error] [client 192.168.33.1] File does not 
exist: 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/myapp/ass1v2
[Mon Jul 14 18:57:44 2014] [error] [client 192.168.33.1] File does not 
exist: 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/myapp/ass1v2
[Mon Jul 14 18:57:44 2014] [error] [client 192.168.33.1] File does not 
exist: 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/myapp/ass1v2

This is the Apache Virtual Host File:

<VirtualHost *:8787>
ServerAdmin test@localhost 

WSGIDaemonProcess sampleapp 
python-path=/var/www/sampleapp:/var/www/sampleapp/env/lib/python2.7/site-packages
WSGIProcessGroup sampleapp

WSGIScriptAlias / 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/wsgi.py
        #WSGIScriptAlias /myapp/index/ 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/wsgi.py
<Directory /var/www/sampleapp/Java/for_django_1-4/myproject/myproject>
Order allow,deny
Allow from all
</Directory>

Alias /media/ 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/media/
Alias /static/ 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/static/
Alias /myapp/ 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/myapp/

<Directory 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/static/>
#Require all granted
         Order allow,deny
         Allow from all
</Directory>

<Directory 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/media/>
#Require all granted
         Order allow,deny
         Allow from all
</Directory>

<Directory 
/var/www/sampleapp/Java/for_django_1-4/myproject/myproject/myapp/>
#Require all granted
         Order allow,deny
         Allow from all
</Directory>

<Directory /var/www/sampleapp/Java/for_django_1-4/myproject/myproject>
<Files wsgi.py>
#Require all granted
</Files>
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

</VirtualHost>

This is the urls.py file:

# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic.simple import redirect_to

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',

    url(r'^admin/', include(admin.site.urls)),
        (r'^myapp/', include('myproject.myapp.urls')),
    # This was the orginal plan
        # (r'^$', redirect_to, {'url': '/myapp/list/'}), # Just for ease of 
use.

    (r'^$', redirect_to, {'url': '/myapp/index/'}), # Just for ease of use.

) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

This is myproject.myapp.urls

# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url

urlpatterns = patterns('myproject.myapp.views',
    url(r'^list/$', 'list', name='list'),
    url(r'^ass1/$', 'ass1', name='ass1'),
    url(r'^ass1v2/$', 'ass1v2', name='ass1v2'),
    url(r'^register/$','register', name='register'), # ADD NEW PATTERN!
    url(r'^login/$', 'user_login', name='login'),
    url(r'^logout/$', 'user_logout', name='logout'),
    url(r'^index/$', 'index', name='index'),
    url(r'^category/(?P<category_name_url>\w+)/$', 'category', 
name='category'),
    url(r'^indexAddJac444/$', 'indexAddJac444', name='indexAddJac444'),
    url(r'^$', 'index', name='index_2'),
)


This is the wsgi.py File:

import os
import sys
import site

root = os.path.join(os.path.dirname(__file__), '..')
sys.path.insert(0, root)

packages = os.path.join(root,
        '/var/www/sampleapp/env/lib/python2.7/site-packages')
sys.path.insert(0, packages)
site.addsitedir(packages)


#A
sys.path.append('/var/www/sampleapp/Java-auto-grader-edx/for_django_1-4/myproject/myproject')
sys.path.append('/var/www/sampleapp/Java-auto-grader-edx/for_django_1-4/myproject')
sys.path.append('/var/www/sampleapp/Java-auto-grader-edx/for_django_1-4')

#Monday July 14:B
sys.path.append('/var/www/sampleapp/Java-auto-grader-edx')
sys.path.append('/var/www/sampleapp')

#sys.path.append('/var/www/sampleapp/Java-auto-grader-edx/for_django_1-4/myproject/')

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)

Does anyone have suggestions as to why I would be getting the directory 
listing and NOT FOUND errors? Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to