简体   繁体   English

使用AWS部署Bottle App

[英]Deploying Bottle App with AWS

I wanted to know how to deploy a app developed using bottle framework in AWS. 我想知道如何在AWS中部署使用Bottle框架开发的应用程序。

I created a EC2 instance, deployed the app in an environment - Linux Python 2.7 64 bit. 我创建了一个EC2实例,并将该应用程序部署在一个环境中-Linux Python 2.7 64位。 I have the main file as application.py and run the framework using bottle.run(host='0.0.0.0") 我的主文件为application.py,并使用bottle.run(host ='0.0.0.0“)运行框架

I get following exception (error.log) 我得到以下异常(error.log)

[Sun Jun 14 16:15:08.989733 2015] [:error] [pid 2400] mod_wsgi (pid=2400): Target WSGI script '/opt/python/current/app/application.py' cannot be loaded as Python module.
[Sun Jun 14 16:15:08.989884 2015] [:error] [pid 2400] mod_wsgi (pid=2400): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Sun Jun 14 16:15:08.989922 2015] [:error] [pid 2400] Traceback (most recent call last):
[Sun Jun 14 16:15:08.989954 2015] [:error] [pid 2400]   File "/opt/python/current/app/application.py", line 31, in <module>
[Sun Jun 14 16:15:08.990035 2015] [:error] [pid 2400]     bottle.run(host='0.0.0.0', port=80)
[Sun Jun 14 16:15:08.990059 2015] [:error] [pid 2400]   File "/opt/python/run/venv/lib/python2.7/site-packages/bottle.py", line 3117, in run
[Sun Jun 14 16:15:08.990094 2015] [:error] [pid 2400]     server.run(app)
[Sun Jun 14 16:15:08.990114 2015] [:error] [pid 2400]   File "/opt/python/run/venv/lib/python2.7/site-packages/bottle.py", line 2771, in run
[Sun Jun 14 16:15:08.990144 2015] [:error] [pid 2400]     srv = make_server(self.host, self.port, app, server_cls, handler_cls)
[Sun Jun 14 16:15:08.990164 2015] [:error] [pid 2400]   File "/usr/lib64/python2.7/wsgiref/simple_server.py", line 151, in make_server
[Sun Jun 14 16:15:08.990197 2015] [:error] [pid 2400]     server = server_class((host, port), handler_class)
[Sun Jun 14 16:15:08.990217 2015] [:error] [pid 2400]   File "/usr/lib64/python2.7/SocketServer.py", line 420, in __init__
[Sun Jun 14 16:15:08.990250 2015] [:error] [pid 2400]     self.server_bind()
[Sun Jun 14 16:15:08.990271 2015] [:error] [pid 2400]   File "/usr/lib64/python2.7/wsgiref/simple_server.py", line 48, in server_bind
[Sun Jun 14 16:15:08.990299 2015] [:error] [pid 2400]     HTTPServer.server_bind(self)
[Sun Jun 14 16:15:08.990319 2015] [:error] [pid 2400]   File "/usr/lib64/python2.7/BaseHTTPServer.py", line 108, in server_bind
[Sun Jun 14 16:15:08.990347 2015] [:error] [pid 2400]     SocketServer.TCPServer.server_bind(self)
[Sun Jun 14 16:15:08.990367 2015] [:error] [pid 2400]   File "/usr/lib64/python2.7/SocketServer.py", line 434, in server_bind
[Sun Jun 14 16:15:08.990394 2015] [:error] [pid 2400]     self.socket.bind(self.server_address)
[Sun Jun 14 16:15:08.990414 2015] [:error] [pid 2400]   File "/usr/lib64/python2.7/socket.py", line 224, in meth
[Sun Jun 14 16:15:08.990442 2015] [:error] [pid 2400]     return getattr(self._sock,name)(*args)
[Sun Jun 14 16:15:08.990475 2015] [:error] [pid 2400] error: [Errno 13] Permission denied

Can let me know where I'm going wrong. 可以让我知道我要去哪里了。

As far as I now, you need to root access to bind to port 80. Try running it with 就我现在而言,您需要root用户访问权限才能绑定到端口80。尝试使用

sudo ./application.py 须藤./application.py

Or you can change your port number to 8080 or similar. 或者,您可以将端口号更改为8080或类似名称。

If you are deploying this for production, I would suggest reading more on the bottlepy docs: 如果您要将其部署到生产环境中,建议您阅读有关瓶装文档的更多信息:

http://bottlepy.org/docs/dev/deployment.html#server-options http://bottlepy.org/docs/dev/deployment.html#server-options

Hope it helps. 希望能帮助到你。 Cheers. 干杯。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM