增加安装脚本
This commit is contained in:
0
install/__init__.py
Normal file
0
install/__init__.py
Normal file
3
install/admin.py
Normal file
3
install/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
0
install/migrations/__init__.py
Normal file
0
install/migrations/__init__.py
Normal file
3
install/models.py
Normal file
3
install/models.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
3
install/tests.py
Normal file
3
install/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
12
install/views.py
Normal file
12
install/views.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# coding=utf-8
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponse
|
||||
|
||||
from account.models import User
|
||||
|
||||
|
||||
def install(request):
|
||||
user = User.objects.create(username="root", admin_type=2)
|
||||
user.set_password("root")
|
||||
user.save()
|
||||
return HttpResponse("success")
|
||||
@@ -11,6 +11,7 @@ from group.views import GroupAdminAPIView
|
||||
from admin.views import AdminTemplateView
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^install/$', "install.views.install"),
|
||||
url("^$", TemplateView.as_view(template_name="oj/index.html"), name="index_page"),
|
||||
url(r'^docs/', include('rest_framework_swagger.urls')),
|
||||
url(r'^admin/$', TemplateView.as_view(template_name="admin/admin.html"), name="admin_spa_page"),
|
||||
|
||||
Reference in New Issue
Block a user