後可見我是一個初學者在Django Django的和CMS,請與我裸...Django的CMS頁面不重新啓動服務器
我一直在使用Django-CMS構築我的GF一個簡單的網站。我正在編輯基本模板,由於某些原因,我的更改沒有完成,所以我重新啓動了nginx服務器腳本,僅僅發現我的恐懼,我看不到任何頁面內容,只有他們的名字在管理界面中的樹。如果我嘗試去一個頁面,它聲稱該頁面不存在。
我想可能是因爲設置有問題,所以我運行修復樹並遷移(這可能是我的錯誤),現在即使頁面名稱在管理界面中也不再可見。頁面及其內容位於數據庫中,但不能再訪問。
有沒有人遇到類似的問題?這可能是一個可能的原因/解決方案?任何想法在哪裏看
我的猜測是,有些東西是錯誤的設置或可能我有一些包的錯誤版本,然後我沒有遇到麻煩,直到我重新啓動。
我希望所有這些網頁都回來,尤其是它們仍然存在於數據庫中。將永遠感激任何幫助。
編輯
我只是想創建一個新的頁面。我能夠做到這一點沒有任何錯誤,該頁面在數據庫中可見,但它不是在「頁面」頁面中可見,並且頁面slu gives給出了一個404錯誤。
EDIT 2
這裏的requirements.txt
aldryn-apphooks-config==0.2.7
aldryn-boilerplates==0.7.4
aldryn-bootstrap3==1.0.10
aldryn-categories==1.0.3
aldryn-common==1.0.4
aldryn-newsblog==1.2.4
aldryn-people==1.2.1
aldryn-reversion==1.0.9
aldryn-style==1.1.1
aldryn-translation-tools==0.2.1
aldryn-video==1.0.0
Babel==2.3.4
backport-collections==0.1
beautifulsoup4==4.4.1
dj-database-url==0.4.1
Django==1.8.15
django-appconf==1.0.2
django-appdata==0.1.5
django-classy-tags==0.8.0
django-cms==3.2.5
django-durationfield==0.5.2
django-filer==1.2.4
django-formtools==1.0
django-mptt==0.8.6
django-parler==1.6.5
django-phonenumber-field==1.1.0
django-polymorphic==0.8.1
django-reversion==1.8.7
django-sekizai==0.10.0
Django-Select2==4.3.2
django-sortedm2m==1.3.2
django-taggit==0.21.2
django-treebeard==4.0.1
djangocms-admin-style==1.2.3
djangocms-attributes-field==0.1.1
djangocms-column==1.6.0
djangocms-file==1.0
djangocms-googlemap==0.5.1
djangocms-inherit==0.2.1
djangocms-installer==0.8.7
djangocms-link==1.8.2
djangocms-picture==0.2.0
djangocms-style==1.7.0
djangocms-teaser==0.2.0
djangocms-text-ckeditor==3.1.0
djangocms-video==1.0.0
easy-thumbnails==2.3
gevent==1.1rc3
greenlet==0.4.9
gunicorn==18.0
html5lib==0.9999999
jsonfield==1.0.3
lxml==3.6.4
micawber==0.3.3
phonenumbers==7.5.2
phonenumberslite==7.5.2
Pillow==3.3.1
psycopg2==2.6.1
python-dateutil==2.5.3
python-slugify==1.2.0
pytz==2016.6.1
six==1.10.0
tzlocal==1.2.2
Unidecode==0.4.19
virtualenv==15.0.1
webencodings==0.5
YURL==0.13
而這裏的設置文件:
import os
gettext = lambda s: s
DATA_DIR = os.path.dirname(os.path.dirname(__file__))
"""
Django settings for anninsivut project.
Generated by 'django-admin startproject' using Django 1.8.14.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
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 = 'VERY SECRET'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['.site.com', ]
# Application definition
ROOT_URLCONF = 'anninsivut.urls'
WSGI_APPLICATION = 'anninsivut.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = 'en'
TIME_ZONE = 'Europe/Amsterdam'
USE_I18N = False
USE_L10N = False
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(DATA_DIR, 'anninsivut', 'media')
STATIC_ROOT = os.path.join(DATA_DIR, 'anninsivut', 'static')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'anninsivut', 'common_static'),
)
SITE_ID = 1
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'anninsivut', 'templates'), ],
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.i18n',
'django.core.context_processors.debug',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.core.context_processors.csrf',
'django.core.context_processors.tz',
'sekizai.context_processors.sekizai',
'django.core.context_processors.static',
'cms.context_processors.cms_settings',
'aldryn_boilerplates.context_processors.boilerplate',
],
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
'aldryn_boilerplates.template_loaders.AppDirectoriesLoader',
],
},
},
]
MIDDLEWARE_CLASSES = (
# 'cms.middleware.utils.ApphookReloadMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware'
)
INSTALLED_APPS = (
'djangocms_admin_style',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.sites',
'django.contrib.sitemaps',
'django.contrib.staticfiles',
'django.contrib.messages',
'cms',
'menus',
'sekizai',
'treebeard',
'djangocms_text_ckeditor',
'djangocms_style',
'djangocms_column',
'djangocms_file',
'djangocms_googlemap',
'djangocms_inherit',
'djangocms_link',
'djangocms_picture',
'djangocms_teaser',
'aldryn_video',
'reversion',
'aldryn_apphooks_config',
'aldryn_boilerplates',
'aldryn_categories',
'aldryn_common',
'aldryn_translation_tools',
'aldryn_newsblog',
'aldryn_people',
'aldryn_reversion',
'aldryn_bootstrap3',
'parler',
'sortedm2m',
'taggit',
'easy_thumbnails',
'filer',
'anninsivut'
)
LANGUAGES = (
## Customize this
('en', gettext('en')),
)
ALDRYN_BOILERPLATE_NAME = 'bootstrap3'
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'aldryn_boilerplates.staticfile_finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
]
CMS_LANGUAGES = {
## Customize this
1: [
{
'name': gettext('en'),
'redirect_on_fallback': True,
'code': 'en',
'public': True,
'hide_untranslated': False,
},
],
'default': {
'redirect_on_fallback': True,
'hide_untranslated': False,
'public': True,
},
}
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
# 'easy_thumbnails.processors.scale_and_crop', # disable this one
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
)
CMS_TEMPLATES = (
## Customize this
('page.html', 'Page'),
('feature.html', 'Page with Feature')
)
CMS_PERMISSION = True
CMS_PLACEHOLDER_CONF = {}
DATABASES = {
'default': {
'CONN_MAX_AGE': 0,
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': 'localhost',
'NAME': 'anninsivut_DB',
'PASSWORD': 'password',
'PORT': '',
'USER': 'user'
}
}
DEFAULT_FROM_EMAIL = '[email protected]'
SERVER_EMAIL = '[email protected]'
ADMINS = (
('Your name', 'your email address'),
)
MIGRATION_MODULES = {
}
@Paulo謝謝你的邀請了這些。現在,我查看了需求和設置文件,發現我在本地Pycharm目錄上的需求文件沒有與服務器上的需求文件同步。在某些時候,我一定會意外升級到服務器端的Django 1.9。現在我猜想,當我重新啓動時,這是當Django-CMS拿起更改並丟失頁面內容。然後,當我看到損失並降級到1.8時,那時我也在頁面樹上丟失了頁面名稱。我將從兩者之間的變化開始,同時看看這些軟件包是否符合他們的要求。
嗨匹配,這可能不是非常有幫助,以解決您的眼前的情況,但你有沒有想過使用更「打包」的Django CMS體驗?例如,Aldryn Desktop(https://www.divio.com/en/)使本地開發和部署變得更容易。 (除了作爲平臺的用戶之外,我不以任何方式附屬於他們) – petr
感謝您的提示。我已經考慮過了,實際上我開始使用Aldryn,但後來想更熟悉Django和Django-CMS的內部工作。那麼,最好小心你想要的東西;現在必須設置一個調試環境和挖... – tarikki
你好@tarikki,請更新您的問題與您的需求文件和settings.py – Paulo