Skip to content

Commit

Permalink
项目打包
Browse files Browse the repository at this point in the history
  • Loading branch information
Benature committed Feb 28, 2020
1 parent 483af44 commit 695a306
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 32 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ python manage.py runserver

```shell
git pull
python manage.py makemigrations
python manage.py migrate
```

---
Expand Down
8 changes: 6 additions & 2 deletions WordReview/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
import pymysql
pymysql.install_as_MySQLdb()
import config
if config.database_type == 'mysql':
import pymysql
pymysql.install_as_MySQLdb()
# import pymysql
# pymysql.install_as_MySQLdb()
2 changes: 2 additions & 0 deletions apps/review/src/init_db.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from pandas import read_excel
# import pandas as pd
import config

# read_excel = pd.read_excel
# bookName = config.BOOK # 请用英文
# List_begin_num = config.begin_index # 或 1,看你的 List 是从 0 开始还是 1 开始

Expand Down
2 changes: 1 addition & 1 deletion apps/review/templates/homepage.pug
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ div.container.flex-column
| {{l.rate}}%
{% endfor %}
{% endfor %}
a(style="text-align:end;margin-top:30px" href="/calendar/") 我要导入新的单词书
a(style="text-align:end;margin-top:30px" href="/import/") 我要导入新的单词书

{% endblock %}
13 changes: 10 additions & 3 deletions apps/review/templates/import_db.pug
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
{% extends "base.pug" %}
{% block title %}导入数据库{% endblock %}
{% block css %}
//- link(href="/static/css/calendar.css" rel="stylesheet")
script(src="/static/js/import_db.js")
script
| $(function () {
| $('#submit-btn').on('click', function (e) {
| //$('#submit-btn').addClass('d-none');
| $('#wait').text('导入数据成功后将自动跳转')
| })
| })
{% endblock %}

{% block content %}

div.d-flex.container.justify-content-center.flex-column
h3(style="margin-bottom:20px;text-align: center;") 导入数据库
{% if message %}
div.alert.alert-warning {{ message }}
div.alert.alert-warning
| 您的输入有问题😯
| {{ message }}
{% endif %}
form(method="post" action='/import/')#pwdForm.d-flex.flex-column
{% csrf_token %}
Expand Down
6 changes: 5 additions & 1 deletion apps/review/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ def homepage(request):
BOOK=BOOK).values_list('LIST')))])
list_info = []
for l in lists:
ld = BookList.objects.get(BOOK=BOOK, LIST=l)
try:
ld = BookList.objects.get(BOOK=BOOK, LIST=l)
except Exception as e:
print(l, e)
continue
# total = sorted([int(i) for i in ld.review_word_counts.split(';')])
list_info.append({
'i': l,
Expand Down
18 changes: 0 additions & 18 deletions config_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@
database_type = 'sqlite'


# ======================================================
# 新增数据库信息配置
# ======================================================

# 初始化数据库时请使用 True,初始化后一定要改回 False!!!
# 初始化数据库时请使用 True,初始化后一定要改回 False!!!
# 初始化数据库时请使用 True,初始化后一定要改回 False!!!
init_db_mode = True # 初始化数据库时请使用 True,初始化后一定要改回 False!!!

BOOK = 'CET6_green' # 单词本的名字(请用英文,不带空格)
BOOK_zh = '新东方六级绿皮书' # 单词本的中文名
BOOK_abbr = 'G' # 单词本的缩写(用于日历显示,建议一个英文大写字符)
begin_index = 0 # 单词本 list、unit、index 的序号从 0 开始还是从 1 开始

# 单词数据的文件路径(建议使用绝对路径,若用相对路径请修改
excel_path = '/file/path/to/excel.xlsx'


# ======================================================
# 数据库使用配置
# (除非你知道你在干嘛,否则请勿修改下面代码)
Expand Down
6 changes: 0 additions & 6 deletions static/js/import_db.js

This file was deleted.

4 changes: 3 additions & 1 deletion static/js/review.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ $(function () {
w.panHistory += remember ? '1' : '0';
w.panTotalNum++;
w.panRate = w.panForgetNum / w.panTotalNum;
w.note = $('#tmpl-note').val();
if ($('#tmpl-note').val() != word) {
w.note = $('#tmpl-note').val();
}

// echarts 画图
currentHistoryX.push(wordCount);
Expand Down

0 comments on commit 695a306

Please sign in to comment.