Hi Folks,
New to creating snaps and I am having a bit of difficulty getting this up and running.
I am running into OSError: [Errno 98] Address already in use
when I run my snap, which runs a flask app.
Thanks for all your help and assistance!
Here is the output of the run:
* Serving Flask app "/snap/test-incuvers-iot-jy/x1/incuvers-iot/"
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
Traceback (most recent call last):
File "/snap/test-incuvers-iot-jy/x1/bin/flask", line 10, in <module>
sys.exit(main())
File "/snap/test-incuvers-iot-jy/x1/lib/python3.6/site-packages/flask/cli.py", line 966, in main
cli.main(prog_name="python -m flask" if as_module else None)
File "/snap/test-incuvers-iot-jy/x1/lib/python3.6/site-packages/flask/cli.py", line 586, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File "/snap/test-incuvers-iot-jy/x1/lib/python3.6/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/snap/test-incuvers-iot-jy/x1/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/snap/test-incuvers-iot-jy/x1/lib/python3.6/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/snap/test-incuvers-iot-jy/x1/lib/python3.6/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/snap/test-incuvers-iot-jy/x1/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/snap/test-incuvers-iot-jy/x1/lib/python3.6/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/snap/test-incuvers-iot-jy/x1/lib/python3.6/site-packages/flask/cli.py", line 860, in run_command
extra_files=extra_files,
File "/snap/test-incuvers-iot-jy/x1/lib/python3.6/site-packages/werkzeug/serving.py", line 1009, in run_simple
inner()
File "/snap/test-incuvers-iot-jy/x1/lib/python3.6/site-packages/werkzeug/serving.py", line 962, in inner
fd=fd,
File "/snap/test-incuvers-iot-jy/x1/lib/python3.6/site-packages/werkzeug/serving.py", line 805, in make_server
host, port, app, request_handler, passthrough_errors, ssl_context, fd=fd
File "/snap/test-incuvers-iot-jy/x1/lib/python3.6/site-packages/werkzeug/serving.py", line 698, in __init__
HTTPServer.__init__(self, server_address, handler)
File "/snap/test-incuvers-iot-jy/x1/usr/lib/python3.6/socketserver.py", line 456, in __init__
self.server_bind()
File "/snap/test-incuvers-iot-jy/x1/usr/lib/python3.6/http/server.py", line 136, in server_bind
socketserver.TCPServer.server_bind(self)
File "/snap/test-incuvers-iot-jy/x1/usr/lib/python3.6/socketserver.py", line 470, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
Init.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
snapcraft.yaml
name: test-incuvers-iot-jy
version: '1.02'
summary: test-incuvers-iot-jy
description: |
Simple test of a hello world flask app.
grade: devel
architectures:
- build-on: amd64
run-on: amd64
confinement: devmode
base: core18
apps:
test-incuvers-iot-jy:
command: flask run
daemon: simple
restart-condition: always
plugs: [home, network, network-bind]
environment:
FLASK_APP: $SNAP/incuvers-iot/
LC_ALL: C.UTF-8
LANG: C.UTF-8
parts:
flask-app:
plugin: python
python-version: python3
python-packages:
[flask]
incuvers-app:
plugin: dump
source: ./app