Hi, django-admin-tool strange problem :S

666 views
Skip to first unread message

Dr.Dran

unread,
Mar 3, 2010, 5:23:19 AM3/3/10
to django-admin-tools
Hi David!

First of all, I would thanx for the great idea, I'm searching for a
dashboard project for django admininterface, and when I see your work,
I don't believe that! It's a miracle, and I will help you if is
possible!

Well, by the way: this is my configuration on django 1.1.1 kubuntu
9.10 python 2.6.4

settings.py:

# -*- coding: utf-8 -*-
# Django settings for taxbook project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

# Make Relativity
import os
SITE_ROOT = os.path.realpath(os.path.dirname(__file__))

ADMINS = (
('Franco Tampieri', 'in...@francotampieri.com'),
)

MANAGERS = ADMINS

DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql',
'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'taxbook' # Or path to database file if using
sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost.
Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not
used with sqlite3.

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as
your
# system time zone.
TIME_ZONE = 'Europe/Rome'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'it-IT'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as
not
# to load the internationalization machinery.
USE_I18N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = os.path.join(SITE_ROOT, 'media')

# URL that handles the media served from MEDIA_ROOT. Make sure to use
a
# trailing slash if there is a path component (optional in other
cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/media/'

# URL prefix for admin media -- CSS, JavaScript and images. Make sure
to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'v@m9imxvkk#s_4%abmat#r8uk1)d#n#vr5^g5f%9cilx0=j%@9'

# List of callables that know how to import templates from various
sources.
TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.auth",
"django.core.context_processors.request",
)

TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)

ROOT_URLCONF = 'taxbook.urls'

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.
os.path.join(SITE_ROOT, 'templates'),
)

INSTALLED_APPS = (
'admin_tools.theming',
'admin_tools.menu',
'admin_tools.dashboard',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django_extensions',
'south',
# Applicazioni della piattaforma
'anagrafica',
)

# Variabili e impostazioni di servizio
AUTH_PROFILE_MODULE = 'anagrafica.AnagraficaUser'

And this is my urls.py:

# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from django.conf import settings

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Example:
# (r'^taxbook/', include('taxbook.foo.urls')),

# Uncomment the admin/doc line below and add
'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
(r'^admin_tools/', include('admin_tools.urls')),
(r'^admin/', include(admin.site.urls)),
)

if settings.DEBUG:
urlpatterns += patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
)

When I start the local dev server:

./manage runserver

I get this error:

On the console:
[03/Mar/2010 11:17:16] "GET /admin HTTP/1.1" 301 0
[03/Mar/2010 11:17:16] "GET /admin/ HTTP/1.1" 500 394313

And in the debug screen of the web browser:

TemplateSyntaxError at /admin/
Caught an exception while rendering: No module named urls

Template error

In template /home/drdran/Sviluppo/Progetti-Python/lib/python2.6/site-
packages/django_admin_tools-0.1.2-py2.6.egg/admin_tools/menu/templates/
admin/base_site.html, error at line 7
Caught an exception while rendering: No module named urls
1 {% extends "admin/base.html" %}
2 {% load i18n admin_tools_menu_tags %}
3 {% block title %}{{ title }} | {% trans 'Django site admin' %}{%
endblock %}
4
5 {% block extrastyle %}
6 {{ block.super }}
7 {% admin_tools_render_menu_css %}
8 {% endblock %}
9
10 {% block branding %}
11 <h1 id="site-name">{% trans 'Django administration' %}</h1>
12 {% endblock %}
13
14 {% block nav-global %}
15 {% if user and user.is_authenticated %}
16 {% admin_tools_render_menu %}
17 {% endif %}

I'm a newbe on django, I began to use it from dicembre 2009, Is a
buggy config in my settings?

Best regards

Franco Tampieri

P.S: If you need help I can translate the po file in Italian :)

David Jean Louis

unread,
Mar 3, 2010, 6:21:45 AM3/3/10
to django-ad...@googlegroups.com, Dr.Dran
Hi Franco,

Le 03/03/2010 11:23, Dr.Dran a �crit :


> TemplateSyntaxError at /admin/
> Caught an exception while rendering: No module named urls
>
> Template error
>

This is a django-admin-tools documentation problem, the documentation is
for the "tip" version of django-admin-tools and you seem to be running
the version 0.1.2, right ?
So, you have two options:
- eitheir comment the django-admin-tools url line in urls.py
- or upgrade to the "tip" version

A 0.2.0 release is in preparation for next week hopefully.

Regards,

--
David

Dr.Dran

unread,
Mar 3, 2010, 7:04:06 AM3/3/10
to django-admin-tools
Yes, you're right, but where I can find the tip versione?

I've installed the 1.2 from easy_install.

I've get the tip from the git repo?

Beste regards

Franco

P.S: Very good chiuce to utilize the jquery 1.41 very smart and
light ;)

David Jean Louis

unread,
Mar 3, 2010, 7:42:05 AM3/3/10
to django-ad...@googlegroups.com, Dr.Dran
Le 03/03/2010 13:04, Dr.Dran a �crit :

> Yes, you're right, but where I can find the tip versione?
>
> I've installed the 1.2 from easy_install.
>
> I've get the tip from the git repo?
>

It's a mercurial repo (not git) hosted at bitbucket.
I highly recommend (in general) that you use "pip" instead or
easy_install, it can do a lot of cool things.
To install the tip using pip just run (with sudo if you're not using
virtualenv) :

$ pip install -e
hg+http://i...@bitbucket.org/izi/django-admin-tools/#egg=django_admin_tools-tip

Regards,

--
David

Franco Tampieri

unread,
Mar 3, 2010, 8:28:20 AM3/3/10
to David Jean Louis, django-ad...@googlegroups.com
Yeah cool!

Downloaded, but my django didn't load the correct css and javascript... hum I think there is somethign wring in my config... did you can help me?

Best Regards

Franco

Franco Tampieri Details:  - Linux User #286282 - FSF Member #5827
GNU/Linux: Hardened / Embedded / H.A. Cluster / System Integrator
Certification: ECDL / LPIC 1 - Acquiring Certification: Cisco CCNA / LPIC 2


2010/3/3 David Jean Louis <izim...@gmail.com>
Le 03/03/2010 13:04, Dr.Dran a écrit :

Yes, you're right, but where I can find the tip versione?

I've installed the 1.2 from easy_install.

I've get the tip from the git repo?
 

It's a mercurial repo (not git) hosted at bitbucket.
I highly recommend (in general) that you use "pip" instead or easy_install, it can do a lot of cool things.
To install the tip using pip just run (with sudo if you're not using virtualenv) :


David Jean Louis

unread,
Mar 3, 2010, 8:44:23 AM3/3/10
to Franco Tampieri, django-ad...@googlegroups.com
Le 03/03/2010 14:28, Franco Tampieri a écrit :
> Yeah cool!
>
> Downloaded, but my django didn't load the correct css and
> javascript... hum I think there is somethign wring in my config... did
> you can help me?

Make sure you follow all the steps described in the documentation:
http://packages.python.org/django-admin-tools/configuration.html
(especially "setting up the django-admin-tools media files")

See also what I have just added to the docs:
http://bitbucket.org/izi/django-admin-tools/diff/docs/configuration.rst?diff2=d36ef5d1e6e7&diff1=3e37f6320d50

--
David

David Jean Louis

unread,
Mar 3, 2010, 10:15:56 AM3/3/10
to Franco Tampieri, django-ad...@googlegroups.com
Le 03/03/2010 16:02, Franco Tampieri a écrit :
> Sorry, but the css/javascript won't work...
>
> When I try di access to localhost:8000/media/css/menu.css (for
> examplet) I receive a page not founde message?!?!
>
> Gulp where I'm wrong? I show u all the configs...
>
> Cheers
>
> Franco

"localhost:8000/media/css/menu.css" is not the correct path, the path to
django-admin-tools media is:

localhost:8000/media/admin_tools/{css,js,images}

As I said, please recheck that you have correctly symlinked or copied
the admin_tools media dir to your media_root, and that you have
correctly setup the MEDIA_URL.
This is all explained in the documentation (see the links I provided in
my previous mail).

Also, first make sure, regardless of django-admin-tools, that your
django install serves static files correctly:
http://docs.djangoproject.com/en/1.1/howto/static-files/#howto-static-files


Regards,

--
David


Reply all
Reply to author
Forward
0 new messages