Re: Why can't I activate the admin site?

24 views
Skip to first unread message

Tom Evans

unread,
Oct 5, 2012, 8:34:48 AM10/5/12
to django...@googlegroups.com
On Fri, Oct 5, 2012 at 9:18 AM, Dae_James <daed...@126.com> wrote:
> I created a new django project and did the following three things:
> 1, Uncomment "django.contrib.admin" in the INSTALLED_APPS setting.
> 2, Run python manage.py syncdb. Since you have added a new application to
> INSTALLED_APPS, the database tables need to be updated.
> 3, Edit your mysite/urls.py file and uncomment the lines that reference the
> admin – there are three lines in total to uncomment.
>
> And then typed in "python manage.py runserver" to start server.
>
> After all this, when I visit http://127.0.0.1:8000/admin/ , welcome site
> displayed instead of the admin site.
> What's the matter, please ? I'm a new hand to django.
>

Can you show your urls? I expect the one for 'welcome site' matches
the url for the admin site before the admin url is tested, and so is
routed there instead.

Cheers

Tom

Dae_James

unread,
Oct 6, 2012, 10:24:21 AM10/6/12
to django...@googlegroups.com, teva...@googlemail.com
My urls is:
from django.conf.urls 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'^$', 'test6.views.home', name='home'),
    # url(r'^test6/', include('test6.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)),
)

Just uncommented three sentences.

Joel Goldstick

unread,
Oct 6, 2012, 2:16:38 PM10/6/12
to django...@googlegroups.com, teva...@googlemail.com
On Sat, Oct 6, 2012 at 10:24 AM, Dae_James <daed...@126.com> wrote:
> My urls is:
> from django.conf.urls 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'^$', 'test6.views.home', name='home'),
> # url(r'^test6/', include('test6.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 looks ok. Try typing in a nonsense url like http://localhost:8000/hi

It won't match anything, but it will list the available urls that you
have. This may give you a clue as to what is going wrong


> Just uncommented three sentences.
>
> On Friday, October 5, 2012 8:35:15 PM UTC+8, Tom Evans wrote:
>>
>> On Fri, Oct 5, 2012 at 9:18 AM, Dae_James <daed...@126.com> wrote:
>> > I created a new django project and did the following three things:
>> > 1, Uncomment "django.contrib.admin" in the INSTALLED_APPS setting.
>> > 2, Run python manage.py syncdb. Since you have added a new application
>> > to
>> > INSTALLED_APPS, the database tables need to be updated.
>> > 3, Edit your mysite/urls.py file and uncomment the lines that reference
>> > the
>> > admin – there are three lines in total to uncomment.
>> >
>> > And then typed in "python manage.py runserver" to start server.
>> >
>> > After all this, when I visit http://127.0.0.1:8000/admin/ , welcome site
>> > displayed instead of the admin site.
>> > What's the matter, please ? I'm a new hand to django.
>> >
>>
>> Can you show your urls? I expect the one for 'welcome site' matches
>> the url for the admin site before the admin url is tested, and so is
>> routed there instead.
>>
>> Cheers
>>
>> Tom
>


--
Joel Goldstick
Reply all
Reply to author
Forward
0 new messages