forked from kongfp/TP_Admin
Compare commits
No commits in common. 'master' and 'master' have entirely different histories.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class App01Config(AppConfig):
|
class AppConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
name = 'app'
|
name = 'app'
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
import logging
|
|
||||||
from rest_framework.views import exception_handler as drf_exception_handler # drf原生处理异常函数取别名
|
|
||||||
from rest_framework.views import Response
|
|
||||||
from rest_framework import status
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger('mylogger')
|
|
||||||
|
|
||||||
|
|
||||||
def exception_handler(exc, context):
|
|
||||||
# drf的exception_handler做基础处理
|
|
||||||
response = drf_exception_handler(exc, context)
|
|
||||||
# 为空,进行自定义二次处理
|
|
||||||
logger.error(str(exc))
|
|
||||||
if response is None:
|
|
||||||
# print(exc) # 错误原因
|
|
||||||
# print(context) # 错误信息
|
|
||||||
# print('%s - %s - %s' % (context['view'], context['request'].method, exc))
|
|
||||||
return Response({
|
|
||||||
'detail': '服务器错误'
|
|
||||||
}, status=status.HTTP_500_INTERNAL_SERVER_ERROR, exception=True)
|
|
||||||
return response
|
|
||||||
|
|
Binary file not shown.
@ -1,9 +0,0 @@
|
|||||||
from rest_framework.pagination import PageNumberPagination
|
|
||||||
|
|
||||||
|
|
||||||
class MyPageNumberPagination(PageNumberPagination):
|
|
||||||
page_size = 10
|
|
||||||
page_query_param = "page"
|
|
||||||
page_size_query_param = "page_size"
|
|
||||||
max_page_size = 100
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
[global]
|
|
||||||
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
|
|
||||||
[install]
|
|
||||||
trusted-host = https://pypi.tuna.tsinghua.edu.cn
|
|
||||||
[list]
|
|
||||||
format=columns
|
|
Binary file not shown.
@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
python manage.py makemigrations&&
|
|
||||||
python manage.py migrate&&
|
|
||||||
uwsgi --ini /home/myproject/uwsgi.ini&&
|
|
||||||
echo 'TP项目启动完成'
|
|
||||||
tail -f /dev/null
|
|
||||||
|
|
||||||
exec "$@"
|
|
Loading…
Reference in New Issue