Django AUTHENTICATION_BACKENDS import error - python

What is the proper way to import a custom backend in settings.py? I currently have the following in settings.py:
AUTHENTICATION_BACKENDS = ('apps.apployment_site.auth.CustomAuth')
where apployment_site is the app, auth is file name, and CustomAuth is the class name.
In my view, I get: ImportError: a doesn't look like a module path after I run the following code:
from django.contrib.auth import authenticate
from apployment_site import *
authenticate(username="username", password="password")
Here's my full settings.py:
"""Django settings for apployment project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '3(a=jr=tfedkqzv3f=495%0$ygxjt332(=n0&h=e2bzh(i#r*j'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'apployment_site'
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
AUTHENTICATION_BACKENDS = ('apps.apployment_site.auth.CustomAuth')
ROOT_URLCONF = 'apployment.urls'
WSGI_APPLICATION = 'apployment.wsgi.application'
# Database
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/dev/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/dev/howto/static-files/
STATIC_URL = '/static/'

make sure it's a tuple:
AUTHENTICATION_BACKENDS = ('apps.apployment_site.auth.CustomAuth',)
note the comma at the end

I don't think you need to actually import it into your view. According to the documentation, Django will go through all your authentication backends when you call authenticate().
Thus, just make sure you have all the authentication backends you want in your settings.py.

Related

"No module named context_processors" django

I am getting No module named context_processors using django 1.7 due to django-baker requirements
main urls:
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^account/', include('account.urls')),
url(r'^postings/', include('postings.urls')),
)
settings.py:
"""
Django settings for myproject project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'byq8q##!vc+!-(my3s0g)_-y4lyhvv#4+u2f-r_)v04m65ogq!'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_extensions',
'django_baker',
'bootstrapform',
# 'emailusernames',
'pinax_theme_bootstrap_account',
'django_forms_bootstrap',
'account',
'postings',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'account.middleware.LocaleMiddleware',
'account.middleware.TimezoneMiddleware',
)
ROOT_URLCONF = 'myproject.urls'
WSGI_APPLICATION = 'myproject.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
TEMPLATE_DIRS = [os.path.join(BASE_DIR, "templates"),]
TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader')
TEMPLATE_CONTEXT_PROCESSORS = [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'account.context_processors.account',
]
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL = '/static/'
AUTHENTICATION_BACKENDS = (
# 'emailusernames.backends.EmailAuthBackend',
'account.auth_backends.EmailAuthenticationBackend',
# Uncomment the following to make Django tests pass:
# 'django.contrib.auth.backends.ModelBackend',
)
LOGIN_URL = "/accounts/login"
ACCOUNT_EMAIL_UNIQUE = True
ACCOUNT_EMAIL_CONFIRMATION_REQUIRED = True
THEME_ACCOUNT_CONTACT_EMAIL = "cchilder#mail.usf.edu"
I followed the instructions at http://django-user-accounts.readthedocs.org/en/latest/installation.html
and http://django-user-accounts.readthedocs.org/en/latest/installation.html
I see the correctly named templates in the https://github.com/pinax/pinax-theme-bootstrap-account/tree/master/pinax_theme_bootstrap_account/templates/account docs, but this error occurs when I try http://127.0.0.1:8005/account/signup/
How can I make these pinax themes work for django 1.7? Thank you

Django Looking for URLS of a Different Project

I have two projects in django that I´m working on at the same time. Today something really strange happened after switching projects.
I have my first project: urls.py and manage.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'agenda.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^agenda/', include('modulo_agenda.urls')),
url(r'^schedule/', include('schedule.urls')),
)
"""
Django settings for agenda project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
PROJECT_ROOT = os.path.abspath(
os.path.join(os.path.dirname(__file__), ".."),
)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
TEMPLATE_PATH = os.path.join(BASE_DIR, 'templates')
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
TEMPLATE_PATH,
)
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '#7j23xm3jv=(#gicejabv2ppa$063st+d#)2x^thld0(#!chwq'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'modulo_agenda',
'schedule',
'djangobower',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
)
ROOT_URLCONF = 'agenda.urls'
WSGI_APPLICATION = 'agenda.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
MEDIA_ROOT = os.path.join(PROJECT_DIR, "site_media")
ADMIN_MEDIA_PREFIX = '/media/'
MEDIA_URL = '/site_media/'
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.request",
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'djangobower.finders.BowerFinder',
)
BOWER_PATH = 'C:/Python34/Lib/site-packages'
BOWER_COMPONENTS_ROOT = os.path.join(PROJECT_ROOT, "components")
BOWER_INSTALLED_APPS = (
'jquery',
'bootstrap'
)
FIRST_DAY_OF_WEEK = 1 # Monday
ROOT_URLCONF = 'agenda.urls'
And my second project settings and urls:
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'proyecto_final_web.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^music/', include('music_manager.urls')),
)
"""
Django settings for proyecto_final_web project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '=%65sc*)pue#)wj&pxd#meh3s_v(^s***+ns(p*8_#pjla_+xo'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'proyecto_final_web.urls'
WSGI_APPLICATION = 'proyecto_final_web.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL = '/static/'
TEMPLATE_PATH=os.path.join(BASE_DIR, 'templates')
TEMPLATE_DIRS = (TEMPLATE_PATH,)
STATIC_PATH = os.path.join(BASE_DIR,'static')
STATICFILES_DIRS = (
STATIC_PATH,
)
The problem I´m having is that when I type run server I get on my agenda project I get:
System check identified no issues (0 silenced).
August 30, 2015 - 13:33:04
Django version 1.7, using settings 'agenda.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
It´s saying it is using agenda.settings, which has ROOT_URLCONF = 'agenda.urls'
But when trying to go to the URL localhots:8000/schedule I get this error:
Using the URLconf defined in proyecto_final_web.urls, Django tried these URL patterns, in this order:
^admin/
^music/
The current URL, schedule/, didn't match any of these.
Which are the URLS defined in my other project. I don´t understand why this happens since on the runserver it is saying it´s using the agenda.settings and not the proyecto_final_web.settings.
Can anyone tell me what might be happening?
Judging from the code above, there seems to be error in PROJECT_ROOT settings. One project has PROJECT_ROOT setting defined and other project does not seem to have this setting.
You need to ensure that PROJECT_ROOT has been defined correctly and for both the projects.

AttributeError: 'module' object has no attribute 'META' in Django Project

I am working on a blog in Python-Django. When I run the command "python manage.py runserver" in my project folder, I get following error:
Traceback (most recent call last):
File "manage.py", line 6, in <module>
server = request.META.get('wsgi.file_wrapper', None)
AttributeError: 'module' object has no attribute 'META'
I have not seen this error anywhere. Should I include Meta class in my installed_apps? How do I do it?
Here is my manage.py:
#!/usr/bin/env python
import os
import sys
from django.http import request
server = request.META.get('wsgi.file_wrapper', None)
if server is not None and server.__module__ == 'django.core.servers.basehttp':
print('inside dev')
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dj1.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
and settings.py:
"""
Django settings for dj1 project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '(l8*%h2ids25q=x9qb7%x+(b=$1mm&yg8b5ga^0u2w9*+k%+9-'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'dj1.urls'
WSGI_APPLICATION = 'dj1.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL = '/static/'
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
)
This is really a big code bulder.
This piece of code here makes no sense inside the manage.py
from django.http import request
server = request.META.get('wsgi.file_wrapper', None)
if server is not None and server.__module__ == 'django.core.servers.basehttp':
print('inside dev')
Perhaps you copied it from somewhere, and didn't put it where it belongs.
This piece of coude would belong in a view. It will never work inside manage.py, and makes asolutely no sense there.
[EDIT]
ALSO, in a view, you should NOT include the import, or you'll get the same error. That means, don't include this from django.http import request

Importing modules in Django (newbie)

I'm new to both Python and Django and am struggling with what I'm sure is a very simple thing. I'm using PyCharm as my ide and am attempting to follow quickstart guide [here][1]. I setup a virtual env as per the tutorial.
The project is "DjangoProjectApp" and the app is "Lunch"
With the files shown below and a browser pointed to http://localhost:8000/admin/ I get the error:
ImportError at /admin/
No module named 'DjangoProjects.Lunch'
But if I comment out the second url route in urls.py then it works. What is the correct way for me to import this module? Thanks.
urls.py:
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'DjangoProjects.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^lunch/$', 'DjangoProjects.Lunch.views.index')
)
views.py
from django.shortcuts import render
# Create your views here.
from django.shortcuts import render_to_response
def index(request):
return render_to_response('index.html')
index.html
hello world!
settings.py
"""
Django settings for DjangoProjects project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'd^d9v4j(1maq-&_8^a+kgicmagxwbv*9m$!2st&vqz$5_h$441'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'Lunch',
'django.contrib.admin',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'DjangoProjects.urls'
WSGI_APPLICATION = 'DjangoProjects.wsgi.application'
# Database
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/dev/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/dev/howto/static-files/
STATIC_URL = '/static/'
Replace that line with :
url(r'^lunch/$', 'Lunch.views.index')
There is no need to specify the name of the project. You should start from the app name.
Also, make sure Lunch is in the INSTALLED_APPS in the settings file.

Static files in django 1.5 - working locally, not working on Heroku

I have a project in Django 1.5 and hosts it on Heroku.
The problem is that I do not see the server static files (CSS, JS) (on the user and administrator) - went through the tutorial available at: https://devcenter.heroku.com/articles/django-assets
but nothing helps.
When I start the application locally using python manage.py runserver - everything works. Below is the code from the file setting.py
import dj_database_url
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'app',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'blog_project.urls'
WSGI_APPLICATION = 'blog_project.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {'default': dj_database_url.config()}
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = 'staticfiles'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
I think you need to change your setting for Heroku so that you include
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
STATICFILES_DIRS = (
os.path.join(PROJECT_PATH, 'static'),
)
Its using a different lookup to
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

Categories