- 博客(13)
- 收藏
- 关注
原创 django富文本django-ckeditor
参考地址: https://www.cnblogs.com/ianduin/p/7732983.html https://github.com/django-ckeditor/django-ckeditor 安装 安装django-ckeditor 安装pillow,图像上传使用 pip install django-ckeditor pip install pillow 配置d...
2018-08-06 22:56:49
439
原创 django 搜索功能的实现
参考文章: 简单搜索功能实现:https://www.zmrenwu.com/post/19/ 复杂搜索功能实现,使用django-haystach:https://github.com/django-haystack/django-haystack views.py: # 搜索功能实现 q = request.GET.get('q', '') error_...
2018-08-05 23:15:43
6186
原创 django列表筛选功能的实现
views,中设置请求的类型 class LawDetailView(View): def get(self, request, law_id): type = request.GET.get('type', '') law = Law.objects.get(id=law_id) return render(request, 'zcf...
2018-08-05 21:48:42
4845
原创 django 分页实现(django-pure-pagination)
使用django-pure-pagination实现django的分页功能: https://github.com/jamespacileo/django-pure-pagination 安装 pip install django-pure-pagination 添加到setting中: INSTALLED_APPS = ( ... 'pure_paginatio...
2018-08-05 20:28:05
1105
原创 xadmin全局配置(主题配置、后台名称页脚版权、菜单样式、app中文名称)
配置后台主题 import xadmin from xadmin import views from .models import Law # 配置后台主题 class BaseSetting(object): enable_themes = True use_bootswatch = True xadmin.site.register(views.BaseAdminVi...
2018-08-04 23:46:07
3552
原创 xadmin的使用
xadmin的安装 参考相关网站: http://sshwsfc.github.io/xadmin/ https://github.com/sshwsfc/xadmin 安装xadmin pip install xadmin 如果是django2.0版本,安装django2.0版本,在github分支中下载zip文件进行安装 pip install xadmin-django2....
2018-08-04 16:39:45
512
原创 Django admin的简单使用
创建models makemigrations migrate createsuperuser 在当前app下的admin.py文件中编写代码,如下: from django.contrib import admin from .models import Law class LawAdmin(admin.ModelAdmin): pass admin.site.re...
2018-08-03 22:58:28
185
原创 django 设置中文和使用北京时间
Django的setting中代码如下: # Internationalization # https://docs.djangoproject.com/en/2.0/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True 更改后: ...
2018-08-03 22:48:08
4731
原创 django static和media文件在setting中的配置
templates文件的配置 TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ 'templates', ], 'APP_DIRS': True, 'OPT...
2018-08-02 23:53:05
500
1
原创 django models的简单配置
代码如下: from datetime import datetime from django.db import models # 政策法规模型 class Law(models.Model): type = models.CharField(choices=(('fl', '法律'), ('xzfg', '行政法规'), ('bmgz', '部门规章'), ...
2018-08-02 23:44:34
368
原创 django views与url的简单配置
如下代码所示: from django.shortcuts import render from django.views import View class LawlistView(View): def get(self, request): return render(request, 'zcfg-list.html', {}) class LawDetail...
2018-08-02 23:43:06
798
原创 nginx+gunicorn配置django环境
安装git yum install git git的简单使用介绍 1 初始化 git init 2 生成ssh Key ssh-keygen -t rsa -C “你的邮箱@qq.com” 3 将~/.ssh/id_rsa.pub写入到gitee设置SSH中 4 确认ssh连接 ssh -T [email protected] 返回Welcome 5 到安装网站根目录 git ...
2018-07-31 23:07:49
380
原创 Centos 7.4 安装Django环境
安装python3.6.5 centos默认安装python2.7,更换为python3,为简便操作,使用Anaconda https://www.anaconda.com/ 1 下载anaconda 2 安装anaconda 3 更新bashrc source ~/.bashrc note:提示unbip2,使用yum install bzip2 安装mysql 参考:http...
2018-07-27 21:45:28
529
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人