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

When i deploy code in GitHub Pages I get error. #548

Closed zakharfsk closed 2 years ago

zakharfsk commented 2 years ago

Hi. When i deploy my code in reposetories and GitHub Pages i get this error:

Failed to load resource: the server responded with a status of 404 ()

index.js:6 Uncaught TypeError: Cannot set properties of null (setting 'onclick')
    at index.js:6

book.html:138 Uncaught (in promise) ReferenceError: eel is not defined
    at GetAllBooks (book.html:138)
    at Books (book.html:146)
    at book.html:148

book.html:142 Uncaught (in promise) ReferenceError: eel is not defined
    at GetPathPhoto (book.html:142)
    at PathBooks (book.html:151)
    at book.html:153

Hovewer, I do not know waht happened, because i when i run local all work. If you need see full code and structure project i can give link repositories.

Python-code:

import eel
from modules.audios import ShelfAudios
from modules.books import ShelfBooks

books = ShelfBooks()
audios = ShelfAudios()

@eel.expose
def bookstore():
    return books.get_books_info()

@eel.expose
def path_photos_books():
    return books.get_photos_path()

@eel.expose
def audiosstore():
    return audios.get_auidos_info()

@eel.expose
def path_audios():
    return audios.get_path_audios()

eel.init(r'./')
eel.start('index.html', size = (700, 700), mode = 'chrome')

HTML-code:

<html>
    <script>

        // functions for get info and path books site
        async function GetAllBooks() {
            return await eel.bookstore()();
        }

        async function GetPathPhoto() {
            return await eel.path_photos_books()();
        }

        (async function Books(){
            let books = await GetAllBooks();
            console.log(books);
        })(); 

        (async function PathBooks(){
            let paths = await GetPathPhoto();
            console.log(paths);
        })(); 

    </script>
</html>
eddyizm commented 2 years ago

I'm pretty sure you can't deploy python backend code on GitHub pages.