new macro DEBUG
This commit is contained in:
parent
60b74ab0be
commit
1e1687bde3
@ -68,6 +68,7 @@ app.py ----服务器的主程序
|
|||||||
* bug:PIN POUT暂时无作用
|
* bug:PIN POUT暂时无作用
|
||||||
* to do:主页面取消跳转,采用判定是否登录的方法改写login logou
|
* to do:主页面取消跳转,采用判定是否登录的方法改写login logou
|
||||||
* fix:当仿真失败时,会提醒用户Fail
|
* fix:当仿真失败时,会提醒用户Fail
|
||||||
|
* new: 代码新增DEBUG宏变量,为False时,关闭print
|
||||||
* 2021年3月31日,前后端更新
|
* 2021年3月31日,前后端更新
|
||||||
|
|
||||||
* 新增:在服务器上成功部署;后端代码为适配centos服务器而做了一些修改。
|
* 新增:在服务器上成功部署;后端代码为适配centos服务器而做了一些修改。
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,6 +2,8 @@ from .main import AuthBaseHandler
|
|||||||
from .account import authenticate, add_user
|
from .account import authenticate, add_user
|
||||||
from .MongoDB import *
|
from .MongoDB import *
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
|
|
||||||
class LoginHandler(AuthBaseHandler):
|
class LoginHandler(AuthBaseHandler):
|
||||||
def get(self,*args,**kwargs):
|
def get(self,*args,**kwargs):
|
||||||
self.render('auth/login.html')
|
self.render('auth/login.html')
|
||||||
@ -16,7 +18,8 @@ class LoginHandler(AuthBaseHandler):
|
|||||||
if passed:
|
if passed:
|
||||||
# 保存cookie信息到redis数据库
|
# 保存cookie信息到redis数据库
|
||||||
self.session.set('username',username) #将前面设置的cookie设置为username,保存用户登录信息
|
self.session.set('username',username) #将前面设置的cookie设置为username,保存用户登录信息
|
||||||
print(self.session.get('username')+' login success !!!')
|
if DEBUG:
|
||||||
|
print(self.session.get('username')+' login success !!!')
|
||||||
next_url = self.get_argument('next', '') # 获取之前页面的路由
|
next_url = self.get_argument('next', '') # 获取之前页面的路由
|
||||||
if next_url:
|
if next_url:
|
||||||
Mongo.connect(DataBase='example',Collection=username)
|
Mongo.connect(DataBase='example',Collection=username)
|
||||||
@ -45,11 +48,13 @@ class LogoutHandler(AuthBaseHandler):
|
|||||||
|
|
||||||
class RegisterHandler(AuthBaseHandler):
|
class RegisterHandler(AuthBaseHandler):
|
||||||
def get(self, *args, **kwargs):
|
def get(self, *args, **kwargs):
|
||||||
print('register')
|
if DEBUG:
|
||||||
|
print('register')
|
||||||
self.render('auth/register.html')
|
self.render('auth/register.html')
|
||||||
|
|
||||||
def post(self, *args, **kwargs):
|
def post(self, *args, **kwargs):
|
||||||
print('registerpost')
|
if DEBUG:
|
||||||
|
print('registerpost')
|
||||||
|
|
||||||
username = self.get_argument('username','')
|
username = self.get_argument('username','')
|
||||||
email = self.get_argument('email','')
|
email = self.get_argument('email','')
|
||||||
@ -65,5 +70,6 @@ class RegisterHandler(AuthBaseHandler):
|
|||||||
else:
|
else:
|
||||||
self.write({'msg':'register fail'})
|
self.write({'msg':'register fail'})
|
||||||
else:
|
else:
|
||||||
print('register again')
|
if DEBUG:
|
||||||
|
print('register again')
|
||||||
self.render('auth/register.html')
|
self.render('auth/register.html')
|
@ -15,6 +15,8 @@ libraries_path = 'D:\\Project_2020\\SPICE\\Pyspice\\libraries'
|
|||||||
#libraries_path = find_libraries()
|
#libraries_path = find_libraries()
|
||||||
spice_library = SpiceLibrary(libraries_path)
|
spice_library = SpiceLibrary(libraries_path)
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
|
|
||||||
class Simulator_CZ :
|
class Simulator_CZ :
|
||||||
|
|
||||||
def __init__( self, title='simulation' ):
|
def __init__( self, title='simulation' ):
|
||||||
@ -30,7 +32,8 @@ class Simulator_CZ :
|
|||||||
def Sim(self, sim_type,properties):
|
def Sim(self, sim_type,properties):
|
||||||
|
|
||||||
parameter = self.Properties_Parse(sim_type,properties)
|
parameter = self.Properties_Parse(sim_type,properties)
|
||||||
print("parameter:\n",parameter)
|
if DEBUG:
|
||||||
|
print("parameter:\n",parameter)
|
||||||
self.simulator = self.circuit.simulator(temperature=25, nominal_temperature=25)
|
self.simulator = self.circuit.simulator(temperature=25, nominal_temperature=25)
|
||||||
# print('simulator:\n',self.simulator)
|
# print('simulator:\n',self.simulator)
|
||||||
if(sim_type == 'transient'):
|
if(sim_type == 'transient'):
|
||||||
@ -41,7 +44,8 @@ class Simulator_CZ :
|
|||||||
use_initial_condition = parameter['use_initial_condition'])
|
use_initial_condition = parameter['use_initial_condition'])
|
||||||
return self.analysis
|
return self.analysis
|
||||||
elif(sim_type == 'dc' ):
|
elif(sim_type == 'dc' ):
|
||||||
print("doing the dc simulation !!!")
|
if DEBUG:
|
||||||
|
print("doing the dc simulation !!!")
|
||||||
src_name = parameter['src_name']
|
src_name = parameter['src_name']
|
||||||
vstart = parameter['start']
|
vstart = parameter['start']
|
||||||
vstop = parameter['stop']
|
vstop = parameter['stop']
|
||||||
@ -49,18 +53,20 @@ class Simulator_CZ :
|
|||||||
the_args = "{} = slice({},{},{})".format(src_name, vstart, vstop, vstep)
|
the_args = "{} = slice({},{},{})".format(src_name, vstart, vstop, vstep)
|
||||||
|
|
||||||
exec("self.analysis = self.simulator.dc( {} )".format(the_args))
|
exec("self.analysis = self.simulator.dc( {} )".format(the_args))
|
||||||
|
if DEBUG:
|
||||||
print("dc simulation finished !!!")
|
print("dc simulation finished !!!")
|
||||||
|
|
||||||
return self.analysis
|
return self.analysis
|
||||||
|
|
||||||
elif(sim_type == 'ac' ):
|
elif(sim_type == 'ac' ):
|
||||||
print("doing the ac simulation !!!")
|
if DEBUG:
|
||||||
|
print("doing the ac simulation !!!")
|
||||||
self.analysis = self.simulator.ac( start_frequency = parameter['start_frequency'],
|
self.analysis = self.simulator.ac( start_frequency = parameter['start_frequency'],
|
||||||
stop_frequency = parameter['stop_frequency'],
|
stop_frequency = parameter['stop_frequency'],
|
||||||
number_of_points = parameter['number_of_points'],
|
number_of_points = parameter['number_of_points'],
|
||||||
variation = parameter['variation'])
|
variation = parameter['variation'])
|
||||||
print("dc simulation finished !!!")
|
if DEBUG:
|
||||||
|
print("dc simulation finished !!!")
|
||||||
return self.analysis
|
return self.analysis
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ from .sim_data_container import Sim_Data_Container
|
|||||||
from tornado.escape import json_decode, json_encode, utf8
|
from tornado.escape import json_decode, json_encode, utf8
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
|
|
||||||
# from bokeh.embed import server_document
|
# from bokeh.embed import server_document
|
||||||
# from jinja2 import Environment, FileSystemLoader
|
# from jinja2 import Environment, FileSystemLoader
|
||||||
@ -20,7 +21,9 @@ class SpiceHandler(AuthBaseHandler):
|
|||||||
username = self.get_current_user()
|
username = self.get_current_user()
|
||||||
message = self.get_argument('spice')
|
message = self.get_argument('spice')
|
||||||
|
|
||||||
print('SpiceHandler: '+username+' \n'+message)
|
if DEBUG:
|
||||||
|
print('SpiceHandler: '+username+' \n'+message)
|
||||||
|
|
||||||
Mongo.connect(DataBase='example',Collection=username)
|
Mongo.connect(DataBase='example',Collection=username)
|
||||||
Mongo.update(behavior=message,tags='spice')
|
Mongo.update(behavior=message,tags='spice')
|
||||||
|
|
||||||
@ -46,11 +49,14 @@ class SimulationHandler(AuthBaseHandler):
|
|||||||
simulator = Simulator_CZ()
|
simulator = Simulator_CZ()
|
||||||
simulator.Get_Spice(spice)
|
simulator.Get_Spice(spice)
|
||||||
analysis = simulator.Sim(sim_type,properties)
|
analysis = simulator.Sim(sim_type,properties)
|
||||||
print('properties:\n',properties)
|
if DEBUG:
|
||||||
print('simulation finished !')
|
print('properties:\n',properties)
|
||||||
|
print('simulation finished !')
|
||||||
|
|
||||||
Container_SimResult.load_analysis(sim_type,analysis)
|
Container_SimResult.load_analysis(sim_type,analysis)
|
||||||
print('data container load data successfully!! ')
|
if DEBUG:
|
||||||
|
print('data container load data successfully!! ')
|
||||||
|
|
||||||
message = "Simulation: Success \n"
|
message = "Simulation: Success \n"
|
||||||
message += "Sim_Type="+ sim_type + "\n Properties=" +properties_str
|
message += "Sim_Type="+ sim_type + "\n Properties=" +properties_str
|
||||||
Mongo.connect(DataBase='example',Collection=username)
|
Mongo.connect(DataBase='example',Collection=username)
|
||||||
|
Loading…
Reference in New Issue
Block a user