Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#17432 closed Bug (needsinfo)

url(r'^admin/', include('admin.site.urls')),

Reported by: info@… Owned by: nobody
Component: contrib.admin Version: 1.3
Severity: Normal Keywords: admin
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

hello dear Developers.

i found a bug.

i'm using ubuntu 11.10 ubuntu and installded django this way

wget http://www.djangoproject.com/download/1.3.1/tarball/
tar xzvf Django-1.3.1.tar.gz

cd Django-1.3.1
python setup.py install

but when i tried to activate the admin i found an error.

the line

url(r'^admin/', include('admin.site.urls')), <---- default


have to look like

url(r'^admin/', include(admin.site.urls)),

Change History (4)

comment:1 by Carl Meyer, 12 years ago

Resolution: needsinfo
Status: newclosed

Can you clarify where the first version of the line (the one marked "<--- default") came from? I've checked both the startproject template and the docs for 1.3.1 and I can't find anywhere that line is found with the quotes.

comment:2 by info@…, 12 years ago

HI the line is in the default urls.py in the projectfolder

default urls.py generated by the comand:

django-admin.py startproject FirstBlog
from django.conf.urls.defaults import patterns, include, url

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

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'FirstBlog.blog.views.home', name='home'),
    # url(r'^FirstBlog/', include('FirstBlog.foo.urls')),

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

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

this is how it shold look like

from django.conf.urls.defaults import patterns, include, url

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

urlpatterns = patterns('',
    # Examples:
    url(r'^$', 'FirstBlog.blog.views.home', name='home'),
    # url(r'^FirstBlog/', include('FirstBlog.foo.urls')),

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

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

comment:3 by Karen Tracey, 12 years ago

I cannot recreate what you are saying, trying exactly what you specify and running on Ubuntu 11.10. First, the wget command you show retrieves the Django 1.3.1 tarball but gives it the name 'index.html', so it's got to be renamed before the tar command. Second, you either need to have activated virtualenv in which to install or preface the python setup.py command with sudo. Finally, after running the startproject command, the urls.py file generated has no quotes around the admin.site.urls.

If it did I would be very puzzled because in no version of the file used to build a project's urls.py file in Django's history has the admin.site.urls spec had quotes around it. The changeset that switched from the old admin.site.root specification to admin.site.urls is here: https://code.djangoproject.com/changeset/9739/django/trunk/django/conf/project_template/urls.py -- there were no quotes included in that change. To find a version of that line that had quotes around the specified thing you have to go all the way back to r7966 (https://code.djangoproject.com/browser/django/trunk/django/conf/project_template/urls.py?rev=7966), the next change (https://code.djangoproject.com/changeset/7967/django/trunk/django/conf/project_template/urls.py) introduced admin.site.root and removed the quotes (and the include, and the (.*) at the end of the pattern).

comment:4 by anonymous, 12 years ago

okay then it sems to be an old version i got.

i found it out because this crashed in my case

on my productiv server the comand django-admin.py startproject example

gave a working urls.py.

so it sems to be only an error on my local version. sorry for reporting an ticket for a personal case.

regart andreas

Note: See TracTickets for help on using tickets.
Back to Top