dimanche 13 septembre 2015

django mysql gives page not found (404) while sqlite works fine

I have two settings files for my django project with different database settings.

First:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'dbname',
        'USER': 'user',
        'PASSWORD': 'megahardbreakingpassword',
        'HOST': 'localhost',
        'PORT': '',
        'OPTIONS': {
            'init_command': 'SET storage_engine=INNODB',
        }
    }
}

And second:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', 
        'NAME': 'db.sqlite3',
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'PORT': '',
    }
}

When I run server with second database settings project works fine, but when I run first settings file with mysql, django returns 404 error for all urls.

I also use django-hosts for implementing subdomains patterns, so maybe something wrong here. My hosts.py code:

from django_hosts import patterns, host


host_patterns = patterns('',
    host(r'^$', 'project.urls', name='host'),
)

I use django 1.4.2 and Python 2.7.9

Aucun commentaire:

Enregistrer un commentaire