Description
- Django Wordpress API version: 0.2.0
- Django version: 1.11.21
- Python version: 2.7.12
- Operating System: windows 7_x64
Description
I got the page not found error when i visit http://127.0.0.1/blog
like this:
Page not found (404)
Request Method: GET
Request URL: http://localhost:8000/blog/
Raised by: wordpress_api.views.BlogListView
this is my settings.py
`import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))
Quick-start development settings - unsuitable for production
See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '*'
SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'html',
'wordpress_api',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = 'website.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR + "/templates",],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.static',
],
},
},
]
WSGI_APPLICATION = 'website.wsgi.application'
Database
https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
Internationalization
https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = 'zh-Hans'
TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
USE_L10N = True
USE_TZ = True
Static files (CSS, JavaScript, Images)
https://docs.djangoproject.com/en/1.8/howto/static-files/
SITE_ID = 1
SITE_ROOT = os.path.join(os.path.abspath(os.path.dirname(file)),'..')
STATIC_ROOT = os.path.join(SITE_ROOT,'static')
STATIC_URL = '/static/'
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
os.path.join(BASE_DIR, "templates").replace('\','/'),
)
STATICFILES_DIRS = (
("css", os.path.join(STATIC_ROOT,'css')),
("javascript", os.path.join(STATIC_ROOT,'javascript')),
("images", os.path.join(STATIC_ROOT,'images')),
("fonts", os.path.join(STATIC_ROOT,'fonts')),
("lang", os.path.join(STATIC_ROOT,'lang')),
)
#ueditor
MEDIA_ROOT = os.path.join(SITE_ROOT,'media/')
MEDIA_URL = '/media/'
WP_URL = 'http://127.0.0.1/wordperss'
BLOG_POSTS_PER_PAGE =5
WP_API_ALLOW_LANGUAGE = True
WP_API_BLOG_CACHE_TIMEOUT = 60 * 60 * 24`