I'am having this issue with django + wsgi, and I can't understand why. When I go to my local website running with apache2 + wsgi, I have this error :
ImportError at /
No module named models
But when i run with development server, everything is ok : python manage.py runserver 0:8080
.
My wsgi.py :
import os, sys
sys.path.append('/var/www/reader')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "reader.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
My models.py
from django.db import models
from django.contrib.auth.models import User
class Feed(models.Model):
display_name = models.CharField(max_length=255)
link_feed = models.CharField(max_length=255)
user = models.ForeignKey(User)
My views.py where the error is throwed :
from django.shortcuts import render
from reader.models import Feed
def index(request):
feeds_list = Feed.objects.all()
context = {'feeds_list': feeds_list}
return render(request, 'home/index.html', context)
And in my settings :
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'reader', <-- this is my app
)
I run under Python 2.7.4 and django 1.5.1.
Could someone explain to me why please ?
Update 1 :
jeremy@dev:/var/www/reader$ tree .
.
├── manage.py
└── reader
├── __init__.py
├── models.py
├── reader.settings
├── settings.py
├── static
│ ├── images
│ ├── scripts
│ │ └── script.js
│ └── styles
│ └── style.css
├── templates
│ ├── base.html
│ ├── home
│ │ └── index.html
│ └── subscription
│ └── add.html
├── urls.py
├── views.py
└── wsgi.py
8 directories, 13 files