python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.44k stars 587 forks source link

Passing a non default instance of `bottle.Bottle` to `eel.start()` does not work #572

Open Sentinent opened 2 years ago

Sentinent commented 2 years ago

Eel version 0.14.0

Describe the bug eel.start() uses bottle.route() to add eel routes, which only adds routes to the default Bottle application. Thus, if a non default instance of bottle.Bottle is passed into eel.start(), the passed in instance will not have eel routes, and will not work properly. Current implementation

To Reproduce

import bottle
import eel

app = bottle.Bottle()
@app.route('/custom')
def some_route():
    return 'Hello World!'
eel.init('web')
eel.start('index.html', port=0, app=app)

The webserver will 404 on any of the eel routes (/eel.js, /eel, any files in web, etc).

Expected behavior Eel will start the bottle server with the routes needed for eel to work.

Additional context Original issue https://github.com/ChrisKnott/Eel/issues/211 was fixed by https://github.com/ChrisKnott/Eel/pull/212, but https://github.com/ChrisKnott/Eel/pull/229 caused a regression of the original issue.

More discussion in PR https://github.com/ChrisKnott/Eel/pull/573