Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running and Usign AccoMontage2 GUI with Flask #8

Open
kaguneschool opened this issue Apr 11, 2023 · 5 comments
Open

Running and Usign AccoMontage2 GUI with Flask #8

kaguneschool opened this issue Apr 11, 2023 · 5 comments

Comments

@kaguneschool
Copy link

kaguneschool commented Apr 11, 2023

Hi! I've been testing AccoMontage2 and it's truly incredible. However, I've had to stick to the console version only as it has been impossible for me to run the app.py provided for several reasons. First, it would seem that, when running the code directly from the console, the chorderator folder is ignored unless it's inside the back-end folder, which is not that huge of a deal anyways.
However, when the app.py is called the web browser will always show a blank page. I though it was because the static folder was acually not called correctly, since in theory the static folder is inside another folder called static as well and the program doesn't take that into consideration. The problem is that when the paths are corrected then a lot of errors start to pop up. Most of them end up in:

werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

In my case, I'm getting this series of errors when trying to run the app.py code:

@Chorderator 2023-04-10 23:45:50,445 - INFO -  start read progressions from dict 
@Chorderator 2023-04-10 23:46:02,078 - INFO -  read progressions done 
@Chorderator 2023-04-10 23:46:02,081 - INFO -  start read progression library from source_base.pnt 
@Chorderator 2023-04-10 23:46:08,120 - INFO -  read library done 
 * Serving Flask app 'app'
 * Debug mode: off
@Chorderator 2023-04-10 23:46:09,355 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
@Chorderator 2023-04-10 23:46:09,356 - INFO - Press CTRL+C to quit
@Chorderator 2023-04-10 23:46:12,101 - ERROR - Exception on / [GET]
Traceback (most recent call last):
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 1788, in dispatch_request
    self.raise_routing_exception(req)
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 1770, in raise_routing_exception
    raise request.routing_exception  # type: ignore
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\ctx.py", line 351, in match_request
    result = self.url_adapter.match(return_rule=True)  # type: ignore
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\werkzeug\routing\map.py", line 624, in match
    raise NotFound() from None
werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 2528, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 1669, in handle_user_exception
    return self.handle_http_exception(e)
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 1609, in handle_http_exception
    return self.ensure_sync(handler)(e)
  File "C:\Users\cesar\Documents\AccoMontage2\back-end\app.py", line 151, in index
    return make_response(send_from_directory('static', 'index.html'))
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\helpers.py", line 590, in send_from_directory
    return werkzeug.utils.send_from_directory(  # type: ignore[return-value]
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\werkzeug\utils.py", line 587, in send_from_directory
    raise NotFound()
werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
@Chorderator 2023-04-10 23:46:12,132 - INFO - 127.0.0.1 - - [10/Apr/2023 23:46:12] "GET / HTTP/1.1" 500 -
@Chorderator 2023-04-10 23:46:13,551 - ERROR - Exception on /favicon.ico [GET]
Traceback (most recent call last):
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 713, in <lambda>
    view_func=lambda **kw: self_ref().send_static_file(**kw),  # type: ignore # noqa: B950
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\scaffold.py", line 331, in send_static_file
    return send_from_directory(
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\helpers.py", line 590, in send_from_directory
    return werkzeug.utils.send_from_directory(  # type: ignore[return-value]
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\werkzeug\utils.py", line 587, in send_from_directory
    raise NotFound()
werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 2528, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 1669, in handle_user_exception
    return self.handle_http_exception(e)
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\app.py", line 1609, in handle_http_exception
    return self.ensure_sync(handler)(e)
  File "C:\Users\cesar\Documents\AccoMontage2\back-end\app.py", line 151, in index
    return make_response(send_from_directory('static', 'index.html'))
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\flask\helpers.py", line 590, in send_from_directory
    return werkzeug.utils.send_from_directory(  # type: ignore[return-value]
  File "C:\Users\cesar\Documents\AccoMontage2\.venv\lib\site-packages\werkzeug\utils.py", line 587, in send_from_directory
    raise NotFound()
werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
@Chorderator 2023-04-10 23:46:13,563 - INFO - 127.0.0.1 - - [10/Apr/2023 23:46:13] "GET /favicon.ico HTTP/1.1" 500 -

I'm running this locally of course.

@billyblu2000
Copy link
Owner

Sorry, I am not able to reproduce your issue.

I think it is true that the static folder was not called correctly. Are you launching the interface in the back-end folder, as shown in the following screenshot?

image

If you launched the project while you are in the project's root folder, we might have some bugs.

@kaguneschool
Copy link
Author

kaguneschool commented May 3, 2023

I've been able to run the server now correctly without getting any errors:

screen

However, when opening the "http://127.0.0.1:5000/" direction it will show a completely blank page, regardless of the browser I'm using. I've tried moving some of the files I thought could be on a wrong path but the issue still persists.

@kaguneschool
Copy link
Author

I'm not sure if it could be that there are files missing on the back-end folder such as /static/js/main.e54d97ab.chunk.js, since checking the asset-manifest I can see it's calling that specific file that is not present on the directory or any directory of the project folder.

@billyblu2000
Copy link
Owner

You are right, thank you for reporting this bug! I have just pushed a fix 78761ea. Hope this would solve the bug.

@kaguneschool
Copy link
Author

Yep, that was the problem indeed! However, unrelated to the whole server and GUI part, there's a error that's popping up a lot for different melodies that I try to load, even if the length and the phrasing info are correct:

error

The error shows up with a bunch of melodies, even ones from the test folder itself. The melody I'm trying right now is on A Major, 4/4, has 4 phrases of 8 bars each and that's exactly how I'm specifying things on the different options. I'll provide the melody I'm using on a ZIP file (since I can't upload MIDI directly). I'm not sure what it can be, as I'm trying to imitate the structure of the sample MIDI files that actually work, such as the 076.mid melody from the MIDI input folder.

faraway.zip

Sorry for the whole trouble, I'm trying to fully understand this as I want to find ways to implement new features and investigate further along the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants