随笔分类 -  Django

摘要:在本地环境中创建和部署Django项目是一个相对简单的过程。以下是详细的步骤: ### 1. 安装Python确保你的系统上安装了Python。Django 3.x 和 4.x 需要 Python 3.6 或更高版本。你可以通过以下命令检查Python版本:```bashpython3 --vers 阅读全文
posted @ 2025-02-13 01:13 Catonce 阅读(6) 评论(0) 推荐(0) 编辑
摘要:list_display 可显示的数据库字段 list_display = ['id', 'name']list_filter 右边栏过滤器 list_filter = ['name']search_fields 可根据什么搜索 search_fields = ['name']ordering 排序 阅读全文
posted @ 2023-02-07 14:33 Catonce 阅读(30) 评论(0) 推荐(0) 编辑
摘要:python manage.py makemigrations python manage.py migrate 阅读全文
posted @ 2023-02-04 16:38 Catonce 阅读(47) 评论(0) 推荐(0) 编辑
摘要:1、部署项目 2、导入 django-simpleui 模块 3、配置到设置 INSTALLED_APPS = [ 'simpleui', 'django.contrib.admin', ........]启动服务,打开后台 :http://127.0.0.1:8000/admin 阅读全文
posted @ 2022-03-06 02:27 Catonce 阅读(104) 评论(0) 推荐(0) 编辑
摘要:LANGUAGE_CODE = 'zh-Hans'TIME_ZONE = 'UTC'USE_I18N = TrueUSE_L10N = TrueUSE_TZ = True 阅读全文
posted @ 2022-03-06 02:23 Catonce 阅读(439) 评论(0) 推荐(0) 编辑
摘要:新建一个超级管理员python manage.py createsuperuser 输入username 输入password,输入邮箱,再次确认密码password 两次密码输入相同时,管理员创建成功 http://127.0.0.1:8000/admin 阅读全文
posted @ 2022-03-06 01:58 Catonce 阅读(62) 评论(0) 推荐(0) 编辑
摘要:一: 项目路由视图创建 二: 工程url包含 PS:地址: http://127.0.0.1:8000//about/ 三: 视图函数 四: 跳转引用,其他界面跳转到about界面 href="{% url 'blog:about' %}" 阅读全文
posted @ 2021-05-17 01:01 Catonce 阅读(65) 评论(0) 推荐(0) 编辑
摘要:一:公共模板 二:其他界面关联 main内容 阅读全文
posted @ 2021-05-17 00:55 Catonce 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2021-05-16 11:02 Catonce 阅读(1111) 评论(0) 推荐(0) 编辑
摘要:一: 切换至目录,创建工程django:django-admin startproject joke_blog 创建应用:python manage.py startapp blog 二: 三: 数据库构建 blog/models.py from django.contrib.auth.models 阅读全文
posted @ 2021-05-13 00:22 Catonce 阅读(63) 评论(0) 推荐(0) 编辑
摘要:在setting.py的__init__.py里 问题: django.core.exceptions.ImproperlyConfigured: mysqlclient 1.4.0 or newer is required 解决方案: import pymysql pymysql.version_ 阅读全文
posted @ 2020-11-07 19:29 Catonce 阅读(119) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示