Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django admin page not found

Tags:

django

admin

basically I've been following the tutorial but I am stuck when it comes to getting the admin page to work. The error I get is: The requested URL /admin/ was not found on this server. So I looked at lots of forums and quite a few stackoverflow question but since I am a complete noob i don't understand half of them and the other half's solution don't solve my problem. This is what my settings.py looks like:

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    'django.contrib.admindocs',
    'polls'
)

This is what my urls.py looks like:

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'^$', 'BoE.views.home', name='home'),
    # url(r'^BoE/', include('BoE.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)),
)

Any help will be much appreciated. Thanks in advance!

like image 519
AmirHBP Avatar asked Jul 20 '12 15:07

AmirHBP


People also ask

Why does Django say Page Not Found?

You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.

Why does Django administrative panel not work?

First of all: Inside your INSTALLED_APPS tuple, in settings.py you have to enable: 'django. contrib. admin' . Second: you have to run python manage.py syncdb after you enable the Django admin app.

Where is Django admin?

The django-admin script should be on your system path if you installed Django via pip . If it's not in your path, ensure you have your virtual environment activated. Generally, when working on a single Django project, it's easier to use manage.py than django-admin .


2 Answers

Did you get the "Welcome to Django" page when you when to http:// 127 0 0 1:8000? (with dots)

Are you going to http:// 127 0 0 1:8000/admin/ ?

Did everything from tutorial part one work? Did you see the items in the database?


In the below comments, we figured that the problem was not with Django, as he had the exact same code that I had (and mine worked). He had to go to wiki.bitnami.org/Components/Django and follow the instructions there

like image 123
SaiyanGirl Avatar answered Oct 15 '22 18:10

SaiyanGirl


I'm going to go ahead and take a stab, because this is the only thing I can think of that could still be the issue.

If you run just python manage.py runserver the dev server binds to 127.0.0.1:8000. However, unless you're running in a browser that is literally on the machine, or otherwise accessing it through the machine directly (X Window, VNC, tunnel, etc), you can't access this remotely.

If you want to access the dev server at the actual IP address, you need to tell it to bind to the primary interface:

python manage.py runserver 0.0.0.0:8000

Then, you'll be able to access your the site in your local browser with http://<ip>:8000/admin/

like image 44
Chris Pratt Avatar answered Oct 15 '22 18:10

Chris Pratt