I have uncommented the admin areas in settings.py & urls.py. However the admin won't load at /admin/. If I change the url to /admin/auth/ then I can login the admin panel, but if I try and go to /admin/ it still won't find the page.
Here is my settings.py :
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'src',
'lib.tagging',
'lib.markdown',
'lib.avatar',
# Uncomment the next line to enable admin documentation:
#'django.contrib.admindocs',
)
URLs.py
from django.conf.urls.defaults import *
from django.conf import settings
from src import views
from src.models import Want
from lib.tagging.models import Tag
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
want_info_dict = {
'queryset': Want.objects.all(),
'date_field': 'pub_date',
}
urlpatterns = patterns('django.views.generic.simple',
url(r'^about/$', 'direct_to_template', {"template":"about.html"}, name="about"),
)
urlpatterns += patterns('',
url(r'^$', views.home, name="home"),
url(r'^signup/$', views.signup, name="signup"),
url(r'^accounts/login/$', views.userlogin, name="login"),
url(r'^accounts/settings/$', views.account_settings, name="settings"),
url(r'^logout/$', 'django.contrib.auth.views.logout', {"next_page":"/"}, name="logout"),
#user profile
url(r'^(?P<username>\w+)/$', views.userprofile, name="user-profile"),
#wants
url(r'^mentees/(?P<slug>[-\w]+)/$', views.wants_by_tag, name="wants_by_tag"),
url(r'^avatar/', include('lib.avatar.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)),
)
if settings.DEBUG:
urlpatterns += patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
)
Thanks for the help!
To login to the site, open the /admin URL (e.g. http://127.0.0.1:8000/admin ) and enter your new superuser userid and password credentials (you'll be redirected to the login page, and then back to the /admin URL after you've entered your details).
Django provides a built-in admin module which can be used to perform CRUD operations on the models. It reads metadata from the model to provide a quick interface where the user can manage the content of the application. This is a built-in module and designed to perform admin related tasks to the user.
Generally, when working on a single Django project, it's easier to use manage.py than django-admin . If you need to switch between multiple Django settings files, use django-admin with DJANGO_SETTINGS_MODULE or the --settings command line option.
the urlpattern for user-profile
conflicts with admin, what happens when you move that pattern to the end, or better yet, prefix it like r'^users/(?P<username>\w+)/$'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With