Skip to content

Commit

Permalink
fix some req
Browse files Browse the repository at this point in the history
  • Loading branch information
mtianyan committed Oct 9, 2020
1 parent 526adb3 commit 5c8263b
Show file tree
Hide file tree
Showing 7 changed files with 3,544 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Vue前台代码地址: https://github.com/mtianyan/vue-mooc

>账号: mtianyan
密码: admin2020
密码: 123456

## 运行指南:

Expand All @@ -27,7 +27,7 @@ docker-compose up
# 导入数据
docker exec -it onlinemooc_mtianyan_mysql_1 bash
mysql -u root -p -D mxonline3 < sql/mxonline3.sql
mysql -u root -p -D online_mooc < sql/online_mooc.sql
# 输入密码: mtianyanroot
```

Expand Down
2 changes: 1 addition & 1 deletion conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
upstream django {
server web: 8000;
server web:8000;
}

server {
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mtianyan_mysql:
command: --default-authentication-plugin=mysql_native_password --mysqlx=0
environment:
- MYSQL_PORT=3306 # cannot change this port to other number
- MYSQL_DATABASE=mxonline3 # name you want for the database
- MYSQL_DATABASE=online_mooc # name you want for the database
- MYSQL_USER=root # change to whatever username you wantr
- MYSQL_ROOT_PASSWORD=mtianyanroot #change to good root password
volumes:
Expand All @@ -16,7 +16,7 @@ mtianyan_nginx:
restart: always
image: nginx
ports:
- "8001:80"
- "8002:80"
volumes:
- ./conf/nginx.conf:/etc/nginx/conf.d/nginx.conf
volumes_from:
Expand Down
11 changes: 11 additions & 0 deletions onlinemooc/custom_exception.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from rest_framework.exceptions import ValidationError
from rest_framework.views import exception_handler


def custom_exception_handler(exc, context):
response = exception_handler(exc, context)
if isinstance(exc, ValidationError):
response.data = {"fields_errors": response.data}
else:
response.data = {"none_fields_errors": response.data}
return response
8 changes: 7 additions & 1 deletion onlinemooc/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
Expand Down Expand Up @@ -167,3 +167,9 @@
EMAIL_HOST_PASSWORD = "tuzosukurdpjihda"
EMAIL_USE_TLS = True
EMAIL_FROM = "[email protected]"
if DEBUG:
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
else:
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
29 changes: 23 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
django
coreapi
django-filter
djangorestframework
mysqlclient
django-simple-captcha
asgiref==3.2.10
certifi==2020.6.20
chardet==3.0.4
coreapi==2.3.3
coreschema==0.0.4
demjson==2.2.4
Django==3.1.2
django-filter==2.4.0
django-ranged-response==0.2.0
django-simple-captcha==0.5.12
djangorestframework==3.12.1
idna==2.10
itypes==1.2.0
Jinja2==2.11.2
MarkupSafe==1.1.1
mysqlclient==2.0.1
Pillow==7.2.0
pytz==2020.1
requests==2.24.0
six==1.15.0
sqlparse==0.3.1
uritemplate==3.0.1
urllib3==1.25.10
3,498 changes: 3,498 additions & 0 deletions sql/online_mooc.sql

Large diffs are not rendered by default.

0 comments on commit 5c8263b

Please sign in to comment.