Ich habe einen Matlab-Simulator und ich möchte eine Web-Anwendung, seit ich Matlab Engine verwendet. Ich kann meinen Matlab-Simulator mithilfe von Django im Entwicklermodus ausführen, aber wenn ich versuche, ihn über Apache im Publisher-Modus auszuführen, wird mir ein Fehler angezeigt, der für mich keinen Sinn ergibt, da er ohne jede Warnung gut im Entwicklermodus funktioniert und Fehler. Ich bringe ein Bild, das den Fehler zeigt.Fehler Transport gestoppt bei der Bereitstellung Matlab App im Internet mit Django durch Apache
Dies ist Fehler in error.log von Apache:
Traceback (most recent call last):
File "/home/bsonlab/myproject/pytom.py", line 46, in <module>
main(sys.argv[1:])
File "/home/bsonlab/myproject/pytom.py", line 29, in main
eng = matlab.engine.start_matlab()
File "/usr/local/lib/python2.7/dist-packages/matlab/engine/__init__.py", line 112, in start_matlab
eng = future.result()
File "/usr/local/lib/python2.7/dist-packages/matlab/engine/futureresult.py", line 68, in result
return self.__future.result(timeout)
File "/usr/local/lib/python2.7/dist-packages/matlab/engine/matlabfuture.py", line 87, in result
handle = pythonengine.getMATLAB(self._future)
matlab.engine.EngineError: Transport stopped.
und hier ist mein Code in view.py und Datei, die Matlab-Engine ruft:
#view.py
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.template import RequestContext
from django.core.urlresolvers import reverse
from CRAN.forms import *
from django.contrib import auth
from django.template.context_processors import csrf
import os
def index(request):
return render(request, 'CRAN/index.html')
def bigdata(request):
return render(request, 'CRAN/bigdata.html')
def summer16(request):
return render(request, 'CRAN/summer16.html')
def cran(request):
return render(request, 'CRAN/cran.html')
def qson(request):
return render(request, 'CRAN/qson.html')
def mobility(request):
return render(request, 'CRAN/mobility.html')
def simulator(request):
if request.method == 'POST':
form = Output(request.POST)
if form.is_valid():
cd = form.cleaned_data
input1 = cd['User_Density']
input2 = cd['RRH_Density']
input3 = cd['Path_Loss_Exponent']
input4 = cd['SIR_Threshold']
input5 = cd['Outage_Capacity']
input6 = cd['NBS_Bargaining']
cmd = "/usr/bin/python /home/bsonlab/myproject/pytom.py --input1 %s --input2 %s --input3 %s --input4 %s --input5 %s --input6 %s" % (input1, input2, input3, input4, input5, input6)
os.system(cmd)
return render(request, 'CRAN/simulatorsecond.html', {'form': form})
else:
form = Output()
return render(request, 'CRAN/simulator.html', {'form': form})
def simulatorsecond(request):
if request.method == 'POST':
form = Output(request.POST)
if form.is_valid():
cd = form.cleaned_data
input1 = cd['User_Density']
input2 = cd['RRH_Density']
input3 = cd['Path_Loss_Exponent']
input4 = cd['SIR_Threshold']
input5 = cd['Outage_Capacity']
input6 = cd['NBS_Bargaining']
cmd = "/usr/bin/python /home/bsonlab/myproject/pytom.py --input1 %s --input2 %s --input3 %s --input4 %s --input5 %s --input6 %s" % (input1, input2, input3, input4, input5, input6)
os.system(cmd)
return render(request, 'CRAN/simulatorsecond.html', {'form': form})
else:
form = Output()
return render(request, 'CRAN/simulatorsecond.html', {'form': form})
und Datei, die ich bin Aufruf Matlab Motor:
#pytom.py
import matlab.engine
import sys, getopt
def main(argv):
print argv
input1 = input2 = input3 = input4 = input5 = input0 = 0.0
input1 = float(argv[1])
input1 = input1/73850
input2 = float(argv[3])
input2 = input2/73850
input3 = float(argv[5])
input4 = float(argv[7])
input5 = float(argv[9])
input6 = float(argv[11])
print((input1, input2, input3, input4, input5, input6))
eng = matlab.engine.start_matlab()
eng.user_centric_CRAN_web_function(input1, input2, input3, input4, input5, input6)
#input1-6 are 0.0003385240352,0.0002031144211,4,0.2,2.5,0.6
if __name__ == "__main__":
main(sys.argv[1:])
user_centric_CRAN_web_function ist eine Matlab-Funktion, die ich in Matlab geschrieben habe und sie ist in demselben Ordner.
Sie sollten den Code und den Fehler ** in Textform ** einfügen. – Laurel
@Laurel Ich füge den Fehler in Textform hinzu. – asikhalaban