增加前端打包
This commit is contained in:
parent
e096dd7ad3
commit
a5f19641b6
|
@ -29,6 +29,13 @@ def reload_server_git():
|
||||||
return completed
|
return completed
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def reload_client_git():
|
||||||
|
command = 'bash {}/git_client.sh'.format(SH_PATH)
|
||||||
|
completed = subprocess.run(command, shell=True, capture_output=True, text=True)
|
||||||
|
return completed
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def reload_server_only():
|
def reload_server_only():
|
||||||
command = 'echo "{}" | sudo -S service supervisor reload'.format(SD_PWD)
|
command = 'echo "{}" | sudo -S service supervisor reload'.format(SD_PWD)
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from apps.develop.views import BackupDatabase, BackupMedia, ReloadServerGit, ReloadServerOnly
|
from apps.develop.views import BackupDatabase, BackupMedia, ReloadClientGit, ReloadServerGit, ReloadServerOnly
|
||||||
|
|
||||||
API_BASE_URL = 'api/develop/'
|
API_BASE_URL = 'api/develop/'
|
||||||
HTML_BASE_URL = 'develop/'
|
HTML_BASE_URL = 'develop/'
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path(API_BASE_URL + 'reload_server_git/', ReloadServerGit.as_view()),
|
path(API_BASE_URL + 'reload_server_git/', ReloadServerGit.as_view()),
|
||||||
|
path(API_BASE_URL + 'reload_client_git/', ReloadClientGit.as_view()),
|
||||||
path(API_BASE_URL + 'reload_server_only/', ReloadServerOnly.as_view()),
|
path(API_BASE_URL + 'reload_server_only/', ReloadServerOnly.as_view()),
|
||||||
path(API_BASE_URL + 'backup_database/', BackupDatabase.as_view()),
|
path(API_BASE_URL + 'backup_database/', BackupDatabase.as_view()),
|
||||||
path(API_BASE_URL + 'backup_media/', BackupMedia.as_view())
|
path(API_BASE_URL + 'backup_media/', BackupMedia.as_view())
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework.permissions import IsAdminUser
|
from rest_framework.permissions import IsAdminUser
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from apps.develop.tasks import backup_database, backup_media, reload_server_git, reload_server_only
|
from apps.develop.tasks import backup_database, backup_media, reload_client_git, reload_server_git, reload_server_only
|
||||||
from rest_framework.exceptions import APIException
|
from rest_framework.exceptions import APIException
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
|
@ -23,6 +23,23 @@ class ReloadServerGit(APIView):
|
||||||
raise APIException(completed.stdout)
|
raise APIException(completed.stdout)
|
||||||
|
|
||||||
|
|
||||||
|
class ReloadClientGit(APIView):
|
||||||
|
authentication_classes = []
|
||||||
|
permission_classes = []
|
||||||
|
|
||||||
|
def post(self, request):
|
||||||
|
"""
|
||||||
|
拉取前端代码并打包
|
||||||
|
|
||||||
|
拉取前端代码并打包
|
||||||
|
"""
|
||||||
|
completed = reload_client_git()
|
||||||
|
if completed.returncode == 0:
|
||||||
|
return Response()
|
||||||
|
else:
|
||||||
|
raise APIException(completed.stdout)
|
||||||
|
|
||||||
|
|
||||||
class ReloadServerOnly(APIView):
|
class ReloadServerOnly(APIView):
|
||||||
permission_classes = [IsAdminUser]
|
permission_classes = [IsAdminUser]
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ urlpatterns = [
|
||||||
# django后台
|
# django后台
|
||||||
path('django/doc/', include('django.contrib.admindocs.urls')),
|
path('django/doc/', include('django.contrib.admindocs.urls')),
|
||||||
path('django/', admin.site.urls),
|
path('django/', admin.site.urls),
|
||||||
path('api-auth/', include('rest_framework.urls')),
|
path('django/api-auth/', include('rest_framework.urls')),
|
||||||
|
|
||||||
# api
|
# api
|
||||||
path('', include('apps.auth1.urls')),
|
path('', include('apps.auth1.urls')),
|
||||||
|
|
Loading…
Reference in New Issue