dot_0620 2017-05-26 06:18 采纳率: 100%
浏览 56
已采纳

GAE / Go挂在本地开发服务器上

I am developing GAE/Go + gin application.

We have now about 25 handlers like this.

func init() {
    r := gin.New()
    r.POST("/path/to/some1", func1)   //  ^
    r.POST("/path/to/some2", func2)   //  |
            :                         //  | about 25 handlers
    r.POST("/path/to/someX", funcX)   //  v
}

I added another handler funcY to above code. and I invoked local development server, but it hangs up during start up.

func init() {                         // Hang up during start up.
    r := gin.New()
    r.POST("/path/to/some1", func1)   
    r.POST("/path/to/some2", func2)   
            :                         
    r.POST("/path/to/someX", funcX)   
    r.POST("/path/to/someY", funcY)   
}

The console log is as below. No message after this.

"C:\Program Files (x86)\JetBrains\Gogland 171.3780.106\binunnerw.exe" C:/go_appengine\goapp.bat serve C:/path/to/app.yaml
INFO     2017-05-26 15:03:02,552 devappserver2.py:764] Skipping SDK update check.
INFO     2017-05-26 15:03:02,996 api_server.py:268] Starting API server at: http://localhost:56094
INFO     2017-05-26 15:03:03,000 dispatcher.py:199] Starting module "default" running at: http://localhost:8080
INFO     2017-05-26 15:03:03,000 admin_server.py:116] Starting admin server at: http://localhost:8000

funcY has no problem because when I remove func1, it starts up normally.

func init() {                         // This works without problem.
    r := gin.New()
    r.POST("/path/to/some2", func2)   
            :                         
    r.POST("/path/to/someX", funcX)   
    r.POST("/path/to/someY", funcY)   
}

Does gin have maximum number of handler? If so, how can I raise it? Or do I have another way to solve this?

[UPDATE] This looks to be the local development server problem. When I deployed to the actual GAE, my app works without problem. How can I solve this problem in the local development server?

  • 写回答

1条回答 默认 最新

  • dotelauv682684 2017-05-27 01:15
    关注

    Self resolved.

    I set gin to release mode and my app works fine.

    gin.SetMode(gin.ReleaseMode)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥15 Attention is all you need 的代码运行