Pylot MVC无法找到控制器

时间:2015-09-18 17:40:28

标签: python model-view-controller

我在Pylot MVC中创建了一个控制器,并且无法弄清楚为什么它不会加载我创建的控制器。我把它命名为恰当的。我的控制器名为courses.py,如下所示:

java.lang.OutOfMemoryError: GC overhead limit exceeded
Dumping heap to java_pid18526.hprof ...
Heap dump file created [1438953690 bytes in 25.846 secs]
Ran out of memory creating debug info for an error
java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.util.HashMap.resize(HashMap.java:580)
    at java.util.HashMap.addEntry(HashMap.java:879)
    at java.util.HashMap.put(HashMap.java:505)
    at java.util.HashSet.add(HashSet.java:217)
    at org.aspectj.apache.bcel.generic.InstructionHandle.addTargeter(InstructionHandle.java:161)
    at org.aspectj.apache.bcel.generic.MethodGen.<init>(MethodGen.java:300)
    at org.aspectj.weaver.bcel.LazyMethodGen.initialize(LazyMethodGen.java:336)
    at org.aspectj.weaver.bcel.LazyMethodGen.markAsChanged(LazyMethodGen.java:504)
    at org.aspectj.weaver.bcel.LazyMethodGen.getBody(LazyMethodGen.java:894)
    at org.aspectj.weaver.bcel.BcelShadow.makeShadowForMethod(BcelShadow.java:679)
    at org.aspectj.weaver.bcel.BcelShadow.makeMethodExecution(BcelShadow.java:675)
    at org.aspectj.weaver.bcel.BcelShadow.makeMethodExecution(BcelShadow.java:655)
    at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2532)
    at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:480)
    at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:99)
    at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1691)
    at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1635)
    at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1400)
    at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1186)
    at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:525)
    at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:361)
    at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:99)
    at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:54)
    at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
    at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:424)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

我的路线设置也很正确

from system.core.model import Model
class Course(Controller):
 def __init__(self):
    super(Course, self).__init__()
 def index(self):
    return self.load_view('index')

当我尝试运行服务器时出现此错误:

  

ImportError:没有名为Courses的模块

关于我可能出错的任何想法?

1 个答案:

答案 0 :(得分:0)

在朋友的帮助下计算出来。我有两个问题。一个我把控制器类命名为错误。应该是这样的课程。

 from system.core.model import Model
 class Courses(Controller):
   def __init__(self):
     super(Courses, self).__init__()
   def index(self):
     return self.load_view('index')

对于获得此相同错误的任何其他人而言,另一个问题是控制器文件本身必须大写。我将我的控制器文件命名为courses.py,它必须是Courses.py。