All Projects → csrftoken → surveySystem

csrftoken / surveySystem

Licence: other
问卷调查系统

Programming Languages

javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to surveySystem

python-django-drf-boilerplate
Django Boilerplate for starting fresh new DRF projects
Stars: ✭ 59 (-20.27%)
Mutual labels:  drf
django-ninja-extra
Django Ninja Extra - Class-Based Utility and more for Django Ninja(Fast Django REST framework)
Stars: ✭ 53 (-28.38%)
Mutual labels:  drf
DjangoStarter
基于Django定制的快速Web开发模板,功能包括:Docker-Compose部署,缓存,业务代码生成器,接口限流,DjangoAdmin验证码,登录次数尝试,屏蔽了RestFramework默认的API主页等
Stars: ✭ 28 (-62.16%)
Mutual labels:  drf
django-rest-framework-datatables-editor
Seamless integration between Django REST framework, Datatables and Datatables Editor.
Stars: ✭ 25 (-66.22%)
Mutual labels:  drf
new-ara-api
KAIST Community Ara Renewal Project - KAIST official BBS
Stars: ✭ 15 (-79.73%)
Mutual labels:  drf
drf-registration
Simple user registration package based on Django Rest Framework. DRF Registration - The easy way to generate registration RESTful APIs
Stars: ✭ 32 (-56.76%)
Mutual labels:  drf
django-project-template
一个django的工程模板,为了快速启动一个工程进行开发
Stars: ✭ 15 (-79.73%)
Mutual labels:  drf
drf-chat-server-example
A chat server example used Django REST framework with pytest
Stars: ✭ 15 (-79.73%)
Mutual labels:  drf
drf-angular-docker-tutorial
Dockerized Django Back-end API using DRF with Angular Front-end Tutorial
Stars: ✭ 53 (-28.38%)
Mutual labels:  drf
django-rest-framework-recaptcha
reCAPTCHA field for Django REST framework serializers
Stars: ✭ 24 (-67.57%)
Mutual labels:  drf
django-rest-multitokenauth
An extension to Django-Rest-Frameworks Token Authentication, enabling a user to have multiple authorization tokens
Stars: ✭ 13 (-82.43%)
Mutual labels:  drf
django-experience
Tutorial Django Experience 2022
Stars: ✭ 173 (+133.78%)
Mutual labels:  drf
Dwsurvey
Open Source Survey System. 最好用的开源问卷调查系统、表单系统。
Stars: ✭ 1,755 (+2271.62%)
Mutual labels:  survey-system
tduck-front
Tduck-填鸭收集器是一款开源的表单在线收集系统,后台基于SpringBoot+MybatisPlus+MySql+Redis,前端基于Vue ElementUI开发,功能强大,界面美观。keywords:问卷/表单/信息收集/survey questionnaire
Stars: ✭ 53 (-28.38%)
Mutual labels:  survey-system

surveySystem

Thank you to all the people who already contributed to this project!


Introduction

后端使用 django & DRF 实现的 restfulApi

前端使用 vue & element-ui

开发环境

  • Python 3.6.8
  • Django 2.1.5
  • Drf 3.9.4

Quick Tutorial

使用虚拟环境(virturalenv)

pip3 install virtualenv

切换到项目目录下, 执行下面的命令
source venv/bin/activate

pip install -r requirements.txt

生成表结构

默认使用 sqlite 数据库

如果您想使用 mysql 数据库,请移步至常见问题(配置完成后,继续如下操作)。

python manage.py makemigrations

python manage.py migrate

导入虚拟数据

python manage.py loaddata init.json

启动项目

python manage.py runserver 0.0.0.0:8023

后台地址:

127.0.0.1:8023/admin/

账号密码 root root123456

效果图及代码结构图

image

image

常见问题

mysql 数据库使用

  • 配置
# 在 settings.py 文件下找到 DATABASES 配置,修改为 

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': '数据库名称',
        'USER': '用户名',
        'PASSWORD': '密码',
        'HOST': '',  # 默认 127.0.0.1
        'PORT': '',  # 默认 3306
    }
}

然后连接至您的数据库终端

$ mysql -u 用户名 -p 密码
创建数据库,记得指定编码
>>> create database 数据库名称 default charset utf8;

第一次执行这条语句报No changes detected

  • 问题
python manage.py makemigrations
  • 解决

web 下面创建目录 migrations 并在里面创建__init__.py

mkdir web/migrations
touch web/migrations/__init__.py

模板渲染冲突

  • 问题
django模板与vue.js冲突问题

django模板与vue.js的变量都是使用“{{”和“}}”包裹起来的,在渲染django模板时会先替代掉所有的“{{”和“}}”及被包裹在其中的内容,使得vue.js没有使用”{{“、”}}”来绑定变量。

  • 解决
1、修改vue.js的默认的绑定符号
    Vue.config.delimiters = ["[[", "]]"];
    
2、使用模板的标签来输出`{{`、`}}`
    详情参见: https://docs.djangoproject.com/en/2.1/ref/templates/builtins/
    
3、禁用django模板渲染
    django标签 verbatim可以使包裹其中的代码不进行渲染保持原样输出
    {% verbatim %}
        {{ vue }}
    {% endverbatim %}

文件下载

  • 问题
 `response` 实现文件流下载, 且点击下载显示文件名称的问题
  • 解决
response['Content-Type'] = 'application/octet-stream'
response['Content-Disposition'] = 'attachment; {}'.format(
    "filename*=utf-8''{}".format(quote(self.file_name))
)

学习资料

# 我所认为的RESTful API最佳实践
http://www.scienjus.com/my-restful-api-best-practices/

# `xlwt` 简单使用

import xlwt

xls = xlwt.Workbook(encoding="utf-8", style_compression=2)
sheet = xls.add_sheet("唯一码", cell_overwrite_ok=True)
sheet.write(0, 0, '号码')

for index, code in enumerate(queryset.iterator(), 1):
    sheet.write(index, 0, code.unique_code)

xls.save(`file_name`)

Donate

如果本仓库对你有帮助,可以请作者喝杯白开水或Star。

Thanks ~

image

Support

2020 By Liuzhichao.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].