Reputation: 11863
Versions: CentOS 6.4, Apache 2.2.15, Django 1.6, mod_wsgi 3.2
I am building a website and have the Django project files in the /srv
directory. I also have SELinux enabled.
I have the basic HTML and CSS already implemented for the website and am trying to use Django CMS to start building the meat of the site. I followed their online documentation and managed to get the Django CMS welcome screen with that little white pony to appear.
However, when I visit: <myIP>/admin
, I get a 404 Page Not Found error. I believe I have the necessary admin code in my files so I am looking for some help on this.
urls.py
from django.conf.urls import patterns, include, url
# Used for CMS
from django.conf.urls.defaults import *
from django.conf import settings
# The next two lines enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^', include('cms.urls')),
url(r'^$', 'mysite.views.home'),
url(r'^admin/', include(admin.site.urls)),
url(r'^support/$', 'mysite.views.support'),
)
if settings.DEBUG:
urlpatterns = patterns('',
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
url(r'', include('django.contrib.staticfiles.urls')),
) + urlpatterns
Excerpts from settings.py
import os
gettext = lambda s: s
PROJECT_PATH = os.path.split(os.path.abspath(os.path.dirname(__file__)))[0]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/srv/mysite/database.sqlite',
}
}
CMS_TEMPLATES = (
('template1.html', 'Template 1'),
('template2.html', 'Template 2'),
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
# These apps are for Django-CMS
'cms',
'mptt',
'menus',
'south',
'sekizai',
'cms.plugins.file',
'cms.plugins.link',
'cms.plugins.text',
'cms.plugins.picture',
)
Any help would be greatly appreciated! I can also provide any other snippets if it would help.
Upvotes: 0
Views: 1612
Reputation: 6735
You might need to put url(r'^', include('cms.urls')),
as the last entry of your url configuration, because cms.urls
contains:
url(r'^(?P<slug>[0-9A-Za-z-_.//]+)$', details, name='pages-details-by-slug')
which also should match /admin/
. So your /admin/
request ends up in the cms, which doesn't have a page there, and 404s.
Upvotes: 3