I'm using django-compressor for a project, but when I run the ./manage compress command I got a list of errors like:
Invalid template /home/somepath: 'some_template_tags' is not a valid tag library: ImportError raised loading postman.templatetags.some_template_tags: cannot import name SomeLibrary
I don't have any extra information. Moreover the application is added to INSTALLED_APPS and the template tags runs normally without django-compressor.
Update:
This is the settings.pyfile:
INSTALLED_APPS = (
'django.contrib.staticfiles',
'cms',
'mptt',
'menus',
'south',
'sekizai',
'classytags',
'postman',
# More apps
'compressor',
)
# More lines
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)
The problem was postman. I replaced the function: get_user_model() with User on the postman/models.py file:
Related
I'm trying to use Django Compressor, which seems pretty straight-forward, but for some reason I keep getting an error, specifically:
When using Django Compressor together with staticfiles, please add 'compressor.finders.CompressorFinder' to the STATICFILES_FINDERS setting
My settings.py file includes the following:
DEBUG = True
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
...
'compressor',
)
STATIC_URL = '/static/'
STATICFILES_FINDER = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder'
]
STATICFILES_DIRS = [
os.path.join(BASE_DIR, '_static'),
]
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
COMPRESS_ENABLED = True
I'm not sure if this is a compatibility issue with Django 1.10 (Django Compressor changelog states it is compatible with 1.10), or if Django Compressor simply is broken, since I've clearly added 'compressor.finders.CompressorFinder' to the STATICFILES_FINDERS setting. I've also tried with DEBUG=False.
Any help is appreciated.
I have followed the celery documentation. yesterday i am able to update the Djcelery models in my Django admin. But today i am not able to update those models. I installed Django toolbar yesterday does it have any impact on functionality
Below is the Django admin screen shot with DDT included in settings.py
Below is the screenshot of Django admin without DDT included in setting.py
Installed Apps
INSTALLED_APPS = (
# django stuff
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# plugins
'precompressed', # https://github.com/jhmaddox/django-precompressed
'social.apps.django_app.default', # http://python-social-auth.readthedocs.org/en/latest/configuration/django.html
'rest_framework', # https://github.com/tomchristie/django-rest-framework
'djcelery', # https://github.com/celery/django-celery
'celery_admin', # https://github.com/mattcaldwell/django-celery-admin-ext
'taggit', # https://github.com/alex/django-taggit
'south', # http://south.readthedocs.org/en/latest/
'storages', # http://django-storages.readthedocs.org/en/latest/
'redactor', # https://github.com/douglasmiranda/django-wysiwyg-redactor
'haystack', # http://django-haystack.readthedocs.org/en/latest/toc.html
'boomers.apps.djangoratings', #https://github.com/dcramer/django-ratings
'crowdsourcing',
# apps
'apps',
'apps.billing.chase',
'apps.billing.paypal',
'apps.billing.amazon',
'apps.config',
'apps.users',
'apps.learn',
'apps.community',
'api.careerbuilder',
'apps.care',
'apps.go',
'apps.play',
'apps.plan',
'apps.uplus',
'apps.billing',
'apps.googleanalytics',
)
and i have appended this INSTALLED_APPS += ('debug_toolbar',)
I'm following the Django-CMS introductory tutorial and have got everything working up to the point where I can run my server and access the admin interface.
However, when I add a page, I cannot select any plugin, it just says No Plugins present. Add a plugin to this placeholder-slot.
In my settings.py file I have:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'cms',
'mptt',
'menus',
'south',
'sekizai',
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
What am I doing wrong here?
Plugins in django-cms are being discovered by looking for cms_plugins module inside each of INSTALLED_APPS. Plugins shipped with the CMS are stored in several separate modules so you should add a line for each of your desired plugins:
INSTALLED_APPS = (
...
'cms.plugins.flash',
'cms.plugins.googlemap',
...
)
am installing the django-admin-tools module to enhance the default django admin with custom dashboard and menus. I have read the docs like a bazillion times
Set up everything the way docs say, but am still merely seeing the Django Admin the SAME WAY is was before I'd even though of django-admin-tools.
What could be wrong?
Am running Django 1.3 and using OpenSuse 11.3
If it helps, the order of apps in my settings.py is like:
INSTALLED_APPS = (
'admin_tools',
'django.contrib.admin',
'admin_tools.theming',
'admin_tools.menu',
'admin_tools.dashboard',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
#'grappelli', #for a sweet django admin look
# 'django.contrib.admindocs',
'django_extensions',
'fpui', #the footprint front-end ui app
)
More Parts of my settings.py in relation to this problem:
ROOTDIR = os.path.abspath(os.path.dirname(__file__))
ADMIN_TOOLS_MEDIA_URL = ROOTDIR + '/media/admin_tools/'
MEDIA_ROOT = ROOTDIR + '/media/admin_tools/'
ADMIN_TOOLS_THEMING_CSS = 'css/theming.css'
MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = '/static/admin/'
ADMIN_TOOLS_INDEX_DASHBOARD = 'footprint.dashboard.CustomIndexDashboard'
ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'footprint.dashboard.CustomAppIndexDashboard'
ADMIN_TOOLS_MENU = 'footprint.menu.CustomMenu'
STATIC_ROOT = ROOTDIR + '/fpui/static/'
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
Had the same problem and finally managed to make it work.
I think your INSTALLED_APPS are ordered correctly - the admin_tools should be before django.contrib.admin. To be absolutely sure push django.contrib.admin below other admin_tools apps too.
The problem is probably somewhere in the other configurations; mine was that admin_tools couldn't access my templates and was running the regular admin instead.
Try the below:
ROOTDIR = os.path.realpath(os.path.dirname(__file__))
MEDIA_ROOT = os.path.join(ROOTDIR,'media')
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(PROJECT_ROOT,'media/static')
STATIC_URL = '/static/'
ADMIN_MEDIA_PREFIX = '/static/admin/'
STATICFILES_DIRS = (
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
ROOT_URLCONF = 'your_project_name.urls'
TEMPLATE_DIRS = (
os.path.join( PROJECT_ROOT, 'templates' ),
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
)
INSTALLED_APPS = (
'admin_tools',
'admin_tools.theming',
'admin_tools.menu',
'admin_tools.dashboard',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
#'grappelli', #for a sweet django admin look
# 'django.contrib.admindocs',
'django_extensions',
'fpui', #the footprint front-end ui app
)
Note that I used realpath for ROOTDIR so that symbolic links may be resolved if there are any. Replace the your_project_name with your project name in ROOT_URLCONF.
Other parameters such as ADMIN_TOOLS_INDEX_DASHBOARD, ADMIN_TOOLS_APP_INDEX_DASHBOARD and ADMIN_TOOLS_APP_INDEX_DASHBOARD are optional, remove them for now so they won't affect the default configuration.
Of course also make sure your urls.py is configured as in the admin_tools guide.
Good luck
Check out the order of your INSTALLED_APPS; It might help if you place the django.contrib.admin just below the django-admin-tools, the order here is used for choosing the right /templates/admin directory.
A little bit late, but I had the same problem, which turned out to be caused by the following circumstance: before installing admin-tools I had overridden one of the admin templates (base-site.html) by putting a modified version in my_project/templates/admin. So it would always use this template instead of the admin_tools one. After removing the custom template it worked.
I am moving my Django app from v1.1 to v1.2.1
However I am stuck on a TemplateSyntax error as seen below. I have not made any other changes to my app
TemplateSyntaxError at /
Caught ImportError while rendering: No module named urls
None of my url reverses in the template seem to work. Here is the culprit line:
{% trans 'Home' %}</div>
It looks like the Template context can't find the url resolver. Here is how my settings look like:
...
ROOT_URLCONF = 'myproject.urls'
TEMPLATE_DIRS = (
os.path.join(PROJECT_DIR, 'templates'),
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.humanize',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.sitemaps',
'myapp',
)
...
This one I just got myself after making some (fairly sweeping) changes. I suspect I made a mistake somewhere in a form, template, or view, and Django reports a misleading error...
(my pages worked pre-change in 1.2.1)