I have terrible problems with django that respond differently to the same requests for no apparent reason.
Sometimes I update, and I see an error, then update and disappear, sometimes the template complains about the missing value, and then stops again, again without explanation.
Sometimes it pulls graphics from a production server, sometimes from a development server.
Worst of all, sometimes, very often, everything looks and loads fine, but the request returns 0 hits, even hard ones, the second request based on the same request loads fine, how does the same request partially fail in one request? For this last one, I have a theory that it does not get the queryset variable from the view at all.
I am losing the search keywords for this problem, I am on the verge of porting the project to php, because at least it always does the same.
The project installs as wsgi using apache2, yes, every time I update, I am sure that the touch wsgi.pyWSGI script.
Please, help.
apache vhost config:
<VirtualHost *>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /home/self/example.com
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/self/example.com>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Alias /media/ /home/self/projects/django/myapp/media/
<Directory /home/self/projects/django/myapp/media/>
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / /home/self/projects/django/myapp/wsgi.py
<Directory /home/self/projects/django/myapp/>
Order allow,deny
Allow from all
</Directory>
ErrorLog /home/self/example.com/error.log
LogLevel warn
CustomLog /home/self/example.com/access.log combined
ServerSignature Off
</VirtualHost>
This is wsgi.py
import os
import sys
sys.path.append('/home/self/projects/django')
sys.path.append('/home/self/projects/django/myapp')
os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
And settings.py
import os
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = os.path.join(PROJECT_DIR, 'myapp.db')
DATABASE_USER = ''
DATABASE_PASSWORD = ''
DATABASE_HOST = ''
DATABASE_PORT = ''
TIME_ZONE = 'America/Tegucigalpa'
LANGUAGE_CODE = 'es-es'
SITE_ID = 1
USE_I18N = True
MEDIA_ROOT = ''
MEDIA_URL = ''
ADMIN_MEDIA_PREFIX = 'http://media.example.com/media/'
AUTH_PROFILE_MODULE = "myapp.userprofile"
LOGIN_URL = "/login"
SECRET_KEY = '1(!u3tvq^=x)y@kny&^eg&uevo6&y%k-wgl$q$-sl_0+s%3g^5'
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'pagination.middleware.PaginationMiddleware',
)
ROOT_URLCONF = 'myapp.urls'
TEMPLATE_DIRS = (
os.path.join(PROJECT_DIR, 'templates'),
)
TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.request",
)
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'myapp',
'pagination',
)
UPDATE:
Now I’m sure that the templates work fine and correctly update the views, which behave randomly, but with the template, sometimes they show old behaviors.
This seems like a caching problem, but I do not do any caching myself, also I always do a touch wsgi.pyscript for updating the WSGI, which is all that is needed to update the application.