基于django+sqlite3的新闻网站管理系统源代码,含数据库文件
创始人
2024-03-21 17:29:22
0

基于django+sqlite3的新闻网站管理系统源代码,含数据库文件
程序部署方法
1、安装程序依赖;
2、 manage.py migrate #初始化数据库;
3、 manage.py createsuperuser创建管理员;
4、manage.py runserver启动程序

完整程序下载地址:基于django+sqlite3的新闻网站管理系统源代码
在这里插入图片描述
首页
在这里插入图片描述
在这里插入图片描述
后台管理
在这里插入图片描述
发布新闻
在这里插入图片描述
核心代码

"""
Django settings for news project.Generated by 'django-admin startproject' using Django 4.0.3.For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import osfrom pathlib import Path# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-vvf5fcm%gok*#-)cr0u3ckrofiwn_g$(s!z0=98=-9i)tgppdw'# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = TrueALLOWED_HOSTS = ['*']# Application definitionINSTALLED_APPS = ['simpleui',# 'import_export','mdeditor','django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles','login','user',]MIDDLEWARE = ['django.middleware.security.SecurityMiddleware','django.contrib.sessions.middleware.SessionMiddleware','django.middleware.common.CommonMiddleware',# 'django.middleware.csrf.CsrfViewMiddleware','django.contrib.auth.middleware.AuthenticationMiddleware','django.contrib.messages.middleware.MessageMiddleware','django.middleware.clickjacking.XFrameOptionsMiddleware','login.SimpleMiddleware.SimpleMiddleware'
]ROOT_URLCONF = 'news.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',# 上下文处理器# 'blog.context_processors.sidebar',# 'blog.context_processors.website_conf',# templates中使用 {{ MEDIA_URL }}{{ 文件名 }} 拼接文件地址'django.template.context_processors.media',],# 用于在模板中自动调用静态文件,不需要每个页面使用 {% load static %} 加载静态文件'builtins': ['django.templatetags.static',],},},
]WSGI_APPLICATION = 'news.wsgi.application'# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databasesDATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3','NAME': BASE_DIR / 'db.sqlite3',}
}# Password validation
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validatorsAUTH_PASSWORD_VALIDATORS = [{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',},{'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',},{'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',},{'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',},
]# Internationalization
# https://docs.djangoproject.com/en/4.0/topics/i18n/LANGUAGE_CODE = 'zh-Hans'TIME_ZONE = 'Asia/Shanghai'USE_I18N = TrueUSE_TZ = False
X_FRAME_OPTIONS = 'SAMEORIGIN'
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
MEDIA_URL = '/media/'STATIC_URL = '/static/'
STATICFILES_DIRS = [BASE_DIR / "static"]SIMPLEUI_LOGO = '/static/img/logo.png'# simpleui 排序后台app导航栏
SIMPLEUI_CONFIG = {'system_keep': True,'menu_display': ['新闻管理', '用户管理', '网站配置', '管理员'],'dynamic': True,'menus': [{'name': '新闻管理','models': [{'name': '新闻列表','url': '/admin/login/news/'}, {'name': '分类列表','url': '/admin/login/type/'}, {'name': '留言列表','url': '/admin/login/message/'}]}, {'name': '网站配置','models': [{'name': '友情链接列表','url': '/admin/login/href/'}, {'name': '赞赏列表','url': '/admin/login/admiration/'}, {'name': '相关信息','url': '/admin/login/myhref1/'}]}, {'name': '用户管理','icon': 'fas fa-user-shield','models': [{'name': '用户列表','url': '/admin/login/user/'}, {'name': '管理员列表','icon': 'fa fa-user','url': 'auth/user/'}]}]
}
# 隐藏右侧SimpleUI广告链接和使用分析
SIMPLEUI_HOME_INFO = False
SIMPLEUI_ANALYSIS = False
# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-fieldDEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

完整程序下载地址:基于django+sqlite3的新闻网站管理系统源代码

相关内容

热门资讯

汽车油箱结构是什么(汽车油箱结... 本篇文章极速百科给大家谈谈汽车油箱结构是什么,以及汽车油箱结构原理图解对应的知识点,希望对各位有所帮...
美国2年期国债收益率上涨15个... 原标题:美国2年期国债收益率上涨15个基点 美国2年期国债收益率上涨15个基...
嵌入式 ADC使用手册完整版 ... 嵌入式 ADC使用手册完整版 (188977万字)💜&#...
重大消息战皇大厅开挂是真的吗... 您好:战皇大厅这款游戏可以开挂,确实是有挂的,需要了解加客服微信【8435338】很多玩家在这款游戏...
盘点十款牵手跑胡子为什么一直... 您好:牵手跑胡子这款游戏可以开挂,确实是有挂的,需要了解加客服微信【8435338】很多玩家在这款游...
senator香烟多少一盒(s... 今天给各位分享senator香烟多少一盒的知识,其中也会对sevebstars香烟进行解释,如果能碰...
终于懂了新荣耀斗牛真的有挂吗... 您好:新荣耀斗牛这款游戏可以开挂,确实是有挂的,需要了解加客服微信8435338】很多玩家在这款游戏...
盘点十款明星麻将到底有没有挂... 您好:明星麻将这款游戏可以开挂,确实是有挂的,需要了解加客服微信【5848499】很多玩家在这款游戏...
总结文章“新道游棋牌有透视挂吗... 您好:新道游棋牌这款游戏可以开挂,确实是有挂的,需要了解加客服微信【7682267】很多玩家在这款游...
终于懂了手机麻将到底有没有挂... 您好:手机麻将这款游戏可以开挂,确实是有挂的,需要了解加客服微信【8435338】很多玩家在这款游戏...