Optimize for Pypi packaging
This commit is contained in:
parent
194c9b108f
commit
4872ec3a76
3894 changed files with 268 additions and 210 deletions
|
@ -1,27 +1,24 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
# import ConfigParser
|
from flask import Flask, g, render_template, request
|
||||||
from flask import g
|
|
||||||
from flask import Flask
|
|
||||||
from flask import request
|
|
||||||
from flask import render_template
|
|
||||||
from flask_babel import Babel
|
from flask_babel import Babel
|
||||||
from flaskext.markdown import Markdown
|
from flaskext.markdown import Markdown
|
||||||
|
|
||||||
from app.cloud.views import viewHomepage
|
from SWSCloudCore.views import viewHomepage
|
||||||
from app.cloud.views.documents import viewDocuments
|
from SWSCloudCore.views.account import viewAccount
|
||||||
from app.cloud.views.kb import viewKB
|
from SWSCloudCore.views.administrator import viewAdministrator
|
||||||
from app.cloud.views.support import viewSupport
|
from SWSCloudCore.views.api import viewAPI
|
||||||
from app.cloud.views.account import viewAccount
|
from SWSCloudCore.views.containers import viewContainers
|
||||||
from app.cloud.views.tasks import viewTasks
|
from SWSCloudCore.views.documents import viewDocuments
|
||||||
from app.cloud.views.payments import viewPayments
|
from SWSCloudCore.views.kb import viewKB
|
||||||
from app.cloud.views.containers import viewContainers
|
from SWSCloudCore.views.server_api import viewServerAPI
|
||||||
from app.cloud.views.administrator import viewAdministrator
|
from SWSCloudCore.views.support import viewSupport
|
||||||
from app.cloud.views.api import viewAPI
|
from SWSCloudCore.views.tasks import viewTasks
|
||||||
from app.cloud.views.server_api import viewServerAPI
|
from SWSCloudCore.views.payments import viewPayments
|
||||||
from app.settings import settings
|
|
||||||
from app import models
|
from SWSCloudCore import models
|
||||||
from app.models import database
|
from SWSCloudCore.models import database
|
||||||
|
from SWSCloudCore.settings import settings
|
||||||
|
|
||||||
app = Flask(__name__, static_folder='static', static_url_path='')
|
app = Flask(__name__, static_folder='static', static_url_path='')
|
||||||
# app.config['SERVER_NAME'] = settings.get('Application', 'SERVER_NAME')
|
# app.config['SERVER_NAME'] = settings.get('Application', 'SERVER_NAME')
|
|
@ -1,6 +1,8 @@
|
||||||
|
# coding: utf-8
|
||||||
|
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
from flask import session
|
from flask import session
|
||||||
from app import models
|
from SWSCloudCore import models
|
||||||
|
|
||||||
|
|
||||||
class ControllerAdministrators:
|
class ControllerAdministrators:
|
||||||
|
@ -12,13 +14,14 @@ class ControllerAdministrators:
|
||||||
|
|
||||||
:param email:
|
:param email:
|
||||||
:param password:
|
:param password:
|
||||||
|
:param status:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
result = models.Admins.select().\
|
result = models.Admins.select().\
|
||||||
where(
|
where(
|
||||||
models.Admins.email == email,
|
models.Admins.email == email,
|
||||||
models.Admins.password == md5(password).hexdigest(),
|
models.Admins.password == md5(password).hexdigest(),
|
||||||
models.Admins.status == status
|
models.Admins.status == status
|
||||||
).count()
|
).count()
|
||||||
|
|
||||||
if result == 0:
|
if result == 0:
|
|
@ -1,5 +1,6 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from app import models
|
|
||||||
|
from SWSCloudCore import models
|
||||||
|
|
||||||
|
|
||||||
class ControllerBilling:
|
class ControllerBilling:
|
|
@ -1,22 +1,19 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
import re
|
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import uuid
|
|
||||||
import smtplib
|
|
||||||
import logging
|
|
||||||
import string
|
|
||||||
import random
|
import random
|
||||||
|
import re
|
||||||
import smtplib
|
import smtplib
|
||||||
from hashlib import md5
|
import string
|
||||||
|
import uuid
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
|
from hashlib import md5
|
||||||
|
|
||||||
from flask import render_template
|
from flask import g, render_template
|
||||||
from flask import g
|
|
||||||
|
|
||||||
from app import models
|
from SWSCloudCore import models
|
||||||
|
|
||||||
|
|
||||||
class ControllerCommon:
|
class ControllerCommon:
|
||||||
|
@ -299,9 +296,9 @@ class Admins:
|
||||||
password_hash = md5(password).hexdigest()
|
password_hash = md5(password).hexdigest()
|
||||||
result = models.Admins.select().\
|
result = models.Admins.select().\
|
||||||
where(
|
where(
|
||||||
models.Admins.email == email,
|
models.Admins.email == email,
|
||||||
models.Admins.password == password_hash,
|
models.Admins.password == password_hash,
|
||||||
models.Admins.status == status
|
models.Admins.status == status
|
||||||
).count()
|
).count()
|
||||||
if result == 0:
|
if result == 0:
|
||||||
return False
|
return False
|
|
@ -1,9 +1,8 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
import uuid
|
|
||||||
import datetime
|
import datetime
|
||||||
from peewee import fn
|
from peewee import fn
|
||||||
from app import models
|
from SWSCloudCore import models
|
||||||
|
|
||||||
|
|
||||||
class ControllerContainers:
|
class ControllerContainers:
|
|
@ -1,4 +1,4 @@
|
||||||
from app import models
|
from SWSCloudCore import models
|
||||||
|
|
||||||
|
|
||||||
class ControllerManageContainers:
|
class ControllerManageContainers:
|
|
@ -1,8 +1,6 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
import uuid
|
from SWSCloudCore import models
|
||||||
from peewee import fn
|
|
||||||
from app import models
|
|
||||||
|
|
||||||
|
|
||||||
class ControllerContainersServer:
|
class ControllerContainersServer:
|
|
@ -1,4 +1,4 @@
|
||||||
from app import models
|
from SWSCloudCore import models
|
||||||
|
|
||||||
|
|
||||||
class ControllerDataCenters:
|
class ControllerDataCenters:
|
|
@ -1,4 +1,4 @@
|
||||||
from app import models
|
from SWSCloudCore import models
|
||||||
|
|
||||||
__author__ = 'vanzhiganov'
|
__author__ = 'vanzhiganov'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
from app import models
|
from SWSCloudCore import models
|
||||||
|
|
||||||
|
|
||||||
class ControllerIps:
|
class ControllerIps:
|
|
@ -1,7 +1,8 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
from app import models
|
|
||||||
|
from SWSCloudCore import models
|
||||||
|
|
||||||
|
|
||||||
class ControllerManageIPs:
|
class ControllerManageIPs:
|
|
@ -1,6 +1,6 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
from app import models
|
from SWSCloudCore import models
|
||||||
|
|
||||||
|
|
||||||
class ControllerPayments:
|
class ControllerPayments:
|
|
@ -1,6 +1,3 @@
|
||||||
from app import models
|
|
||||||
|
|
||||||
|
|
||||||
class ControllerServerServerAPI:
|
class ControllerServerServerAPI:
|
||||||
def report_set(self):
|
def report_set(self):
|
||||||
pass
|
pass
|
|
@ -1,4 +1,4 @@
|
||||||
from app import models
|
from SWSCloudCore import models
|
||||||
|
|
||||||
__author__ = 'vanzhiganov'
|
__author__ = 'vanzhiganov'
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import datetime
|
import datetime
|
||||||
from app import models
|
|
||||||
|
from SWSCloudCore import models
|
||||||
|
|
||||||
|
|
||||||
class ControllerServerStatistics:
|
class ControllerServerStatistics:
|
|
@ -1,6 +1,7 @@
|
||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
from app import models
|
|
||||||
|
from SWSCloudCore import models
|
||||||
|
|
||||||
|
|
||||||
class ControllerTasks:
|
class ControllerTasks:
|
|
@ -1,5 +1,6 @@
|
||||||
import json
|
import json
|
||||||
from app import models
|
|
||||||
|
from SWSCloudCore import models
|
||||||
|
|
||||||
|
|
||||||
class ControllerManageTasks:
|
class ControllerManageTasks:
|
|
@ -1,8 +1,11 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from app import models
|
|
||||||
from app.cloud.controllers.containers.server import ControllerContainersServer
|
from SWSCloudCore import models
|
||||||
|
from SWSCloudCore.controllers.containers.server import ControllerContainersServer
|
||||||
|
|
||||||
|
|
||||||
# from peewee import fn
|
# from peewee import fn
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,12 +87,12 @@ class ControllerTasksServer:
|
||||||
|
|
||||||
# delete all container statistics
|
# delete all container statistics
|
||||||
delstats = models.ContainersStatistics.delete().where(
|
delstats = models.ContainersStatistics.delete().where(
|
||||||
models.ContainersStatistics.container == task['plain']['container_id']
|
models.ContainersStatistics.container == task['plain']['container_id']
|
||||||
)
|
)
|
||||||
delstats.execute()
|
delstats.execute()
|
||||||
# delete stats state
|
# delete stats state
|
||||||
delstatsstate = models.ContainersStatisticsState.delete().where(
|
delstatsstate = models.ContainersStatisticsState.delete().where(
|
||||||
models.ContainersStatisticsState.container == task['plain']['container_id']
|
models.ContainersStatisticsState.container == task['plain']['container_id']
|
||||||
)
|
)
|
||||||
delstatsstate.execute()
|
delstatsstate.execute()
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
import string
|
|
||||||
import random
|
import random
|
||||||
|
import string
|
||||||
import uuid
|
import uuid
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
from app import models
|
|
||||||
|
from SWSCloudCore import models
|
||||||
|
|
||||||
|
|
||||||
class ControllerUsers:
|
class ControllerUsers:
|
||||||
|
@ -64,9 +65,9 @@ class ControllerUsers:
|
||||||
password_hash = md5(password).hexdigest()
|
password_hash = md5(password).hexdigest()
|
||||||
result = models.Users.select().\
|
result = models.Users.select().\
|
||||||
where(
|
where(
|
||||||
models.Users.email == email,
|
models.Users.email == email,
|
||||||
models.Users.password == password_hash,
|
models.Users.password == password_hash,
|
||||||
models.Users.status == status
|
models.Users.status == status
|
||||||
).count()
|
).count()
|
||||||
if result == 0:
|
if result == 0:
|
||||||
return False
|
return False
|
|
@ -1,6 +1,6 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
from app import models
|
from SWSCloudCore import models
|
||||||
from . import ControllerUsersDetails
|
from . import ControllerUsersDetails
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
from peewee import PostgresqlDatabase
|
|
||||||
from peewee import Model, UUIDField, CharField, ForeignKeyField, IntegerField
|
|
||||||
from peewee import DateTimeField, TextField, FloatField, BigIntegerField
|
from peewee import DateTimeField, TextField, FloatField, BigIntegerField
|
||||||
from app.settings import settings
|
from peewee import Model, UUIDField, CharField, ForeignKeyField, IntegerField
|
||||||
|
from peewee import PostgresqlDatabase
|
||||||
|
|
||||||
|
from SWSCloudCore.settings import settings
|
||||||
|
|
||||||
# connect to database
|
# connect to database
|
||||||
database = PostgresqlDatabase(
|
database = PostgresqlDatabase(
|
Before Width: | Height: | Size: 280 KiB After Width: | Height: | Size: 280 KiB |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue