diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2cb7182 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# 使用官方 Python 基础镜像 +FROM python:3.11-slim-buster + +# 设置工作目录 +WORKDIR /app + +# 将项目文件复制到容器中 +COPY. /app + +# 安装项目依赖 +RUN pip install --no-cache-dir -r requirements.txt + +# 设置环境变量 +ENV DJANGO_SETTINGS_MODULE=your_project_name.settings + +# 暴露容器端口 +EXPOSE 8000 + +# 运行 Django 项目 +CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] \ No newline at end of file diff --git a/SinkDark/SinkDark/settings.py b/SinkDark/SinkDark/settings.py index cb8dc63..3ee196b 100644 --- a/SinkDark/SinkDark/settings.py +++ b/SinkDark/SinkDark/settings.py @@ -7,9 +7,9 @@ BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = '+f%vbh_8b+(*kp=clju)691popu%a*#60ik99n4(n2ex9g$)_a' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = False -ALLOWED_HOSTS = ['*'] +ALLOWED_HOSTS = ['crossdark.com'] # Application definition diff --git a/SinkDark/article/models.py b/SinkDark/article/models.py index 76aef77..47f9c1e 100644 --- a/SinkDark/article/models.py +++ b/SinkDark/article/models.py @@ -36,9 +36,9 @@ class ArticleInfo(models.Model): # 在文章每次保存时运行 self.rendered, meta = CrossDown.main(self.content) # 渲染md print(meta) - if 'title' in meta: + if 'title' in meta: # 设置标题 self.title = meta['title'][0] - if 'summary' in meta: + if 'summary' in meta: # 设置简介 self.brief = meta['summary'][0] super().save(*args, **kwargs) # 保存 diff --git a/SinkDark/static/css/base.css b/SinkDark/static/css/base.css index c51ba3a..6581138 100644 --- a/SinkDark/static/css/base.css +++ b/SinkDark/static/css/base.css @@ -1,12 +1,21 @@ @charset "UTF-8"; +@font-face { + font-family: 'DuanNing'; /* 定义字体名称 */ + src: url('../fonts/段宁毛笔小楷.ttf') format('truetype'); /* 指定字体文件路径和格式 */ +} +@font-face { + font-family: 'SetoFont'; /* 定义字体名称 */ + src: url('../fonts/小濑字体.ttf') format('truetype'); /* 指定字体文件路径和格式 */ +} /* css */ * { margin: 0; padding: 0 } body { - font: 15px "Microsoft YaHei", Arial, Helvetica, sans-serif; /* 设置字体大小和字体族 */ + font: 15px "DuanNing", "Microsoft YaHei", Arial, Helvetica, sans-serif; /* 设置字体大小和字体族 */ background-image: url('../images/盐湖.png'); /* 设置背景图片 */ line-height: 1.5; /* 设置行高为字体大小的1.5倍 */ background-size: cover; /* 背景图片覆盖整个元素区域,可能会被裁剪以保持宽高比 */ background-repeat: no-repeat; /* 背景图片不重复 */ + background-attachment: fixed; /* 背景图片固定,不随页面滚动 */ } img { border: 0; display: block } ul, li { list-style: none; } @@ -16,10 +25,48 @@ a:hover { text-decoration: none; color: #000; } .blank { height: 20px; overflow: hidden; width: 100%; margin: auto; clear: both } .f_l { float: left } .f_r { float: right } -article { width: 1000px; margin: 80px auto 0; overflow: hidden; zoom: 1; } -aside { width: 30%; float: left; overflow: hidden; display: block; position: relative; z-index: 1 } +.grid-container { + display: grid; + grid-template-columns: 1fr 3fr 1fr; /* 左侧和右侧各占1份空间,中间占2份 */ + grid-gap: 10px; /* 网格间隙 */ + width: 90%; /* 确保容器宽度为父元素的100% */ + margin: 80px +} -main { overflow: hidden; width: 68%; float: right; display: block; } +.lb_box{ + /* 左侧占位用 */ +} + +.rb_box{ + /* 右侧占位用 */ +} + +.md_box{ + /* 中间占位用 */ + position: fixed; +} + + +.l_box { + /* 左侧内容样式 */ + position: fixed; + width: 18%; + left: 5%; +} + +.l_box { + /* 左侧内容样式 */ + position: fixed; + width: 18%; + right: 5%; +} + +.main { + overflow: hidden; + width: 100%; + margin: 0 auto; /* 添加左右自动外边距以实现水平居中 */ + display: block; /* 已经是默认值,但保持清晰 */ +} .container { width: 1000px; margin: auto } nav { width: 1000px; margin: auto } .logo { float: left; font-size: 22px } diff --git a/SinkDark/static/css/index.css b/SinkDark/static/css/index.css index b822f39..16f3856 100644 --- a/SinkDark/static/css/index.css +++ b/SinkDark/static/css/index.css @@ -1,4 +1,4 @@ - @charset "gb2312"; + @charset "UTF-8"; .l_box h2 { color: #333; font-size: 14px; line-height: 30px; padding-left: 20px; background: #fff } .l_box div { background: rgba(255,255,255,0.5); margin-bottom: 20px; overflow: hidden } .l_box div ul { padding: 10px; overflow: hidden } @@ -12,18 +12,20 @@ .tuijian li { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; margin-bottom: 5px; background: url(../images/li.png) left center no-repeat; padding-left: 20px } .links a { display: block; float: left; margin: 0 10px 5px 0 } .guanzhu img { width: 100% } +.tools a { display: block; float: left; margin: 0 10px 5px 0 } .l_box .search { border: 1px solid #000; background: #000; border-radius: 0 5px 5px 0; position: relative; } .search input.input_submit { border: 0; background: 0; color: #fff; outline: none; position: absolute; top: 10px; right: 8% } .search input.input_text { border: 0; line-height: 36px; height: 36px; width: 72%; padding-left: 10px; outline: none } -.r_box li { background: rgba(255,255,255,0.8); padding: 15px; overflow: hidden; color: #797b7c; margin-bottom: 20px } -.r_box li h3 { font-size: 16px; line-height: 25px; text-shadow: #FFF 1px 1px 1px } -.r_box li h3 a { color: #222 } -.r_box li h3 a:hover { color: #000; text-decoration: underline } -.r_box li img { float: right; clear: right; width: 100%;height:100%; -webkit-transition: all 0.5s; -moz-transition: all 0.5s; transition: all 0.5s; } -.r_box li i { width: 150px; display: block; max-height: 100px; overflow: hidden; float: right; margin-left: 20px } -.r_box li p { margin: 20px 0 0 0; line-height: 22px; overflow: hidden; text-overflow: ellipsis; -webkit-box-orient: vertical; display: -webkit-box; -webkit-line-clamp: 2; } -.r_box li:hover img { transform: scale(1.05) } -.r_box li:hover h3 a { color: #19585d; } +.rt_box .search { border: 1px solid #000; background: #000; border-radius: 0 5px 5px 0; position: relative; } +.main li { background: rgba(255,255,255,0.8); padding: 15px; overflow: hidden; color: #797b7c; margin-bottom: 20px } +.main li h3 { font-size: 16px; line-height: 25px; text-shadow: #FFF 1px 1px 1px } +.main li h3 a { color: #222 } +.main li h3 a:hover { color: #000; text-decoration: underline } +.main li img { float: right; clear: right; width: 100%;height:100%; -webkit-transition: all 0.5s; -moz-transition: all 0.5s; transition: all 0.5s; } +.main li i { width: 150px; display: block; max-height: 100px; overflow: hidden; float: right; margin-left: 20px } +.main li p { margin: 20px 0 0 0; line-height: 22px; overflow: hidden; text-overflow: ellipsis; -webkit-box-orient: vertical; display: -webkit-box; -webkit-line-clamp: 2; } +.main li:hover img { transform: scale(1.05) } +.main li:hover h3 a { color: #19585d; } .pagelist { text-align: center; color: #666; width: 100%; clear: both; margin: 20px 0; padding-top: 20px } .pagelist a { color: #666; margin: 0 2px 5px 2px; display: inline-block; border: 1px solid #fff; padding: 5px 10px; background: #FFF } .pagelist a:hover { color: #19585d; } diff --git a/SinkDark/static/css/info.css b/SinkDark/static/css/info.css index 2eb9a64..395433c 100644 --- a/SinkDark/static/css/info.css +++ b/SinkDark/static/css/info.css @@ -1,4 +1,4 @@ -@charset "gb2312"; +@charset "UTF-8"; .infosbox { overflow: hidden; background: rgba(255,255,255,0.8); margin-bottom: 20px } .newsview { padding: 0 30px } .news_con a { color: #0e6dad } diff --git a/SinkDark/static/css/m.css b/SinkDark/static/css/m.css index 84b1195..e396680 100644 --- a/SinkDark/static/css/m.css +++ b/SinkDark/static/css/m.css @@ -1,4 +1,4 @@ -@charset "gb2312"; +@charset "UTF-8"; @media screen and (min-width: 1024px) and (max-width: 1199px) { header { width: 96%; margin: auto } } diff --git a/requirement.txt b/requirement.txt deleted file mode 100644 index ec3516b..0000000 --- a/requirement.txt +++ /dev/null @@ -1,3 +0,0 @@ -django>=5.1.1 -django-mdeditor>=0.1.20 -CrossDown>=0.11.0 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..86fd481 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +CrossDown==2.2.0 +Django==5.1.1 +django-ckeditor==6.7.1 +django-js-asset==2.2.0 +django-mdeditor==0.1.20 +emoji==2.13.2