python manage.py migrate
在过去的几周里,我偶尔会在 Aldryn 网站上工作时尝试跑步,但从未奏效。它并没有让我感到困扰,但我认为它可能应该(我对 Django CMS 及其方式很陌生,如果我现在不让它工作,我担心这会咬我)。这是我在运行命令时得到的输出:
Joey-Keetons-Mac-Pro-2:fringeclass sparkholiday$ python manage.py migrate
/Users/sparkholiday/Documents/aldryn workspace folder/fringeclass/addons/aldryn-
django/aldryn_config.py:48: RuntimeWarning: no database configured. Falling back
to DATABASE_URL=sqlite:////Users/sparkholiday/Documents/aldryn workspace folder
/fringeclass/data/db.sqlite3
RuntimeWarning,
/Users/sparkholiday/Documents/aldryn workspace folder/fringeclass/addons/aldryn-
django/aldryn_config.py:56: RuntimeWarning: no cache configured. Falling back to
CACHE_URL=locmem://
RuntimeWarning,
Traceback (most recent call last):
File "manage.py", line 7, in <module>
startup.manage(path=os.path.dirname(os.path.abspath(__file__)))
File "/Library/Python/2.7/site-packages/aldryn_django/startup.py", line 12, in
manage
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", l
ine 302, in execute
settings.INSTALLED_APPS
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 55, in
__getattr__
self._setup(name)
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 43, in
_setup
self._wrapped = Settings(settings_module)
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 99, in
__init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/i
mportlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/sparkholiday/Documents/aldryn workspace folder/fringeclass/settin
gs.py", line 28, in <module>
aldryn_addons.settings.load(locals())
File "/Library/Python/2.7/site-packages/aldryn_addons/settings.py", line 142,
in load
settings_json_path=settings_json_path,
File "/Library/Python/2.7/site-packages/aldryn_addons/settings.py", line 174,
in load_addon_settings
aldryn_config.Form().to_settings(addon_settings, settings)
File "/Users/sparkholiday/Documents/aldryn workspace folder/fringeclass/addons
/aldryn-django/aldryn_config.py", line 123, in to_settings
self.server_settings(settings, env=env)
File "/Users/sparkholiday/Documents/aldryn workspace folder/fringeclass/addons
/aldryn-django/aldryn_config.py", line 211, in server_settings
os.path.dirname(settings['NGINX_CONF_PATH']),
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpat
h.py", line 122, in dirname
i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
我知道 Python 中的 NoneType 情况意味着正在调用的东西不存在,或者没有正确定义,它似乎指向 NGINX 配置,但我不知道如何修复它。其他地方的某个线程上的某个人(不记得在哪里)建议有人通过完全摆脱涉及 NGINX 的代码段来解决基本相同的问题,但是......我需要那个东西!这是aldryn_config.py
文件中部分的代码aldryn-django
(我认为没有人希望我发布整个文件,但如果有帮助,我会编辑它):
def server_settings(self, settings, env):
settings['PORT'] = env('PORT', 80)
settings['BACKEND_PORT'] = env('BACKEND_PORT', 8000)
settings['ENABLE_NGINX'] = env('ENABLE_NGINX', False)
settings['ENABLE_PAGESPEED'] = env(
'ENABLE_PAGESPEED',
env('PAGESPEED', False),
)
settings['ENABLE_BROWSERCACHE'] = env(
'ENABLE_BROWSERCACHE',
env('BROWSERCACHE', False),
)
settings['BROWSERCACHE_MAX_AGE'] = env('BROWSERCACHE_MAX_AGE', 300)
settings['NGINX_CONF_PATH'] = env('NGINX_CONF_PATH')
settings['NGINX_PROCFILE_PATH'] = env('NGINX_PROCFILE_PATH')
settings['PAGESPEED_ADMIN_HTPASSWD_PATH'] = env(
'PAGESPEED_ADMIN_HTPASSWD_PATH',
os.path.join(
os.path.dirname(settings['NGINX_CONF_PATH']),
'pagespeed_admin.htpasswd',
)
)
settings['PAGESPEED_ADMIN_USER'] = env('PAGESPEED_ADMIN_USER')
settings['PAGESPEED_ADMIN_PASSWORD'] = env('PAGESPEED_ADMIN_PASSWORD')
settings['DJANGO_WEB_WORKERS'] = env('DJANGO_WEB_WORKERS', 3)
settings['DJANGO_WEB_MAX_REQUESTS'] = env('DJANGO_WEB_MAX_REQUESTS', 500)
settings['DJANGO_WEB_TIMEOUT'] = env('DJANGO_WEB_TIMEOUT', 120)
我的settings.py
(因为让我们让它更长,嗯?):
# -*- coding: utf-8 -*-
INSTALLED_ADDONS = [
# <INSTALLED_ADDONS> # Warning: text inside the INSTALLED_ADDONS tags is auto-generated. Manual changes will be overwritten.
'aldryn-addons',
'aldryn-django',
'aldryn-sso',
'aldryn-django-cms',
'aldryn-devsync',
'aldryn-background-image',
'aldryn-bootstrap3',
'aldryn-categories',
'aldryn-common',
'aldryn-disqus',
'aldryn-emailsettings',
'aldryn-faq',
'aldryn-forms',
'aldryn-gallery',
'aldryn-mailchimp',
'aldryn-newsblog',
'aldryn-people',
'aldryn-style',
'djangocms-fbcomments',
'reversion',
'aldryn_reversion',
'sortedm2m',
'taggit',
'filer',
'easy_thumbnails',
'djangocms_text_ckeditor',
'aldryn_translation_tools',
'aldryn_boilerplates',
# </INSTALLED_ADDONS>
]
import aldryn_addons.settings
aldryn_addons.settings.load(locals())
# all django settings can be altered here
INSTALLED_APPS.extend([
# add you project specific apps here
])
ALDRYN_BOILERPLATE_NAME='bootstrap3'
TEMPLATE_CONTEXT_PROCESSORS.extend([
'aldryn_boilerplates.context_processors.boilerplate',
# add your template context processors here
])
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
# 'easy_thumbnails.processors.scale_and_crop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
'easy_thumbnails.processors.background',
)
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
# important! place right before django.contrib.staticfiles.finders.AppDirectoriesFinder
'aldryn_boilerplates.staticfile_finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
]
MIDDLEWARE_CLASSES.extend([
# add your own middlewares here
])
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'aldryn_boilerplates.template_loaders.AppDirectoriesLoader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader'
)
非常感谢您阅读本文——任何建议都会很棒!我喜欢前端编辑,但如果您无法使用 CSS,它就不是很有用!我想我可以使用 git(git 和 docker 都在没有迁移命令的情况下工作,这就是为什么我推迟了这么长时间),但我怀疑我缺乏迁移导致我的虚拟环境出现问题,这最终可能是一场噩梦:/