Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Readme
目次
zfl-blogs
$ pip install zfl-blogs
settings.py
の編集
INSTALLED_APPS = [
...
'django.forms',
'django_cleanup',
'markdownx',
'blogs',
]
FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'
...
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
...
'blogs.context.common',
],
# カスタムテンプレートフィルター
'libraries': {
'mark': 'blogs.templatetags.mark',
}
},
},
]
...
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
MARKDOWNX_IMAGE_MAX_SIZE = {'size': (800, 500), 'quality': 100}
MARKDOWNX_UPLOAD_MAX_SIZE = 1000 * 1024 # 最大1MBまで可能
MARKDOWNX_UPLOAD_CONTENT_TYPES = ['image/jpeg', 'image/png', 'image/gif']
MARKDOWNX_MARKDOWN_EXTENSIONS = [
'extra',
'admonition', # 訓戒・忠告
'sane_lists', # 正常なリスト
'toc', # 目次
'nl2br', # 改行
]
MARKDOWNX_MARKDOWN_EXTENSION_CONFIGS = {
'toc': {
'title': '目次',
'permalink': True
}
}
urls.py
の編集
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('markdownx/', include("markdownx.urls")),
path('blogs/', include("blogs.urls")),
]
# 開発環境での設定
if settings.DEBUG == True:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
settings.py
のFORM_RENDERER
でdjango.forms.renderers.TemplatesSetting
に設定しているので、プロジェクト直下にtemplates
ディレクトリを作成し、blogs
アプリのtemplates
ディレクトリからmarkdownx
ディレクトリをコピーしてきます。
そうすることで、記事を書く際のマークダウンプレビューを横並びにすることができます。
$ python3 -c "import blogs; print(blogs.__path__)"
データベースの作成
$ python3 manage.py migrate
スーパーユーザーの作成
$ python3 manage.py createsuperuser
markdownxで保存された画像を整理するコマンドの実行
$ python3 manage.py file_cleanup
zfl-blogs
is distributed under the terms of the MIT license.
FAQs
blogs on zfl
We found that zfl-blogs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.