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 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)