tilburgsciencehub / music-to-scrape

A fictitious music streaming service with a real website and API so you can learn how to scrape!
https://music-to-scrape.org
3 stars 6 forks source link

start building front end #15

Closed hannesdatta closed 1 year ago

hannesdatta commented 1 year ago

Prerequisites:

Deliverables:

Flask App, using a modified version of #4, with the following views:

hannesdatta commented 1 year ago

Great work on the front end! Here's my feedback:

LANDING PAGE

As far as I'm concerned, you can continue building the artist sites, user sites, and search result page

hannesdatta commented 1 year ago

Thierry on 11 April 2023, 1:22pm:

Ik heb de pagina's die stonden in de issue gebouwd (user page, artist page, search results). Deze zijn nu terug te vinden in de repository.

hannesdatta commented 1 year ago

Here's my feedback:

LANDING PAGE

Amazing work! Thanks!

image

ARTIST PAGE

Picture perfect :).

SEARCH RESLUTS

USER PAGE

Picture perfect as well!

thierrylahaije commented 1 year ago

All issues you mentioned above have been adjusted and fixed.

As far as the Flask App goes I have created the following pages:

Summary for what still needs to be done in my vision:

Whenever you have time, check the Flask App and please give me your pros and cons so I can continue on it next week. We will also need to schedule a small 15 minutes meeting to discuss some small details. After this, I think the Flask App will be done by next Friday.

hannesdatta commented 1 year ago

Hi Hannes, ik heb weer een nieuwe commit gedaan. Deze bevat o.a. de wijzigingen die je had gevraagd in issue #15 en daarnaast het begin van de flask applicatie. Tot noch toe bevat deze alleen de index pagina, maar ik ben nu bezig met de artist page end de user page, en ik ga er vanuit dat ik deze eind van deze middag kan toevoegen aan de repository.

I've tried running this but can't get it to work.

image

It seems BOTH pieces try to use port 8000, but that one is operated by the API.

When I first launch the app, I don't get this error (but then the API doesn't start).

Can you please update the readme.md to reflect on how to properly set this up? I feel something is missing in the instruction to make it work.

hannesdatta commented 1 year ago

I also tried starting up flask with gunicorn main:api -bind 0.0.0.0:80, but get this error message when the app runs:

(base) hannesdatta@Hanness-MacBook-Pro flask_app % gunicorn main:app --bind 0.0.0.0:80
[2023-04-17 13:57:43 +0200] [1521] [INFO] Starting gunicorn 20.1.0
[2023-04-17 13:57:43 +0200] [1521] [INFO] Listening at: http://0.0.0.0:80 (1521)
[2023-04-17 13:57:43 +0200] [1521] [INFO] Using worker: sync
[2023-04-17 13:57:43 +0200] [1525] [INFO] Booting worker with pid: 1525
/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py:834: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.
  warnings.warn(FSADeprecationWarning(
[2023-04-17 13:57:49,787] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/util/_collections.py", line 1008, in __call__
    return self.registry[key]
KeyError: <greenlet.greenlet object at 0x7fe86c6c8040>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/hannesdatta/Research projects/apis-to-scrape/flask_app/main.py", line 74, in index
    recent_tracks = db.session.query(listening.timestamp, songs.ArtistName, songs.Title)\
  File "<string>", line 2, in query
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/orm/scoping.py", line 24, in _proxied
    return self.registry()
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/util/_collections.py", line 1010, in __call__
    return self.registry.setdefault(key, self.createfunc())
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 4195, in __call__
    return self.class_(**local_kw)
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 138, in __init__
    bind = options.pop('bind', None) or db.engine
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 937, in engine
    return self.get_engine()
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 956, in get_engine
    return connector.get_engine()
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 560, in get_engine
    options = self.get_options(sa_url, echo)
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 575, in get_options
    self._sa.apply_driver_hacks(self._app, sa_url, options)
  File "/Users/hannesdatta/opt/anaconda3/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 908, in apply_driver_hacks
    sa_url.database = os.path.join(app.root_path, sa_url.database)
AttributeError: can't set attribute
[2023-04-17 13:58:27 +0200] [1521] [INFO] Handling signal: winch
[2023-04-17 13:58:27 +0200] [1521] [INFO] Handling signal: winch
[2023-04-17 13:58:27 +0200] [1521] [INFO] Handling signal: winch
[2023-04-17 13:58:27 +0200] [1521] [INFO] Handling signal: winch
[2023-04-17 13:58:27 +0200] [1521] [INFO] Handling signal: winch
[2023-04-17 13:58:27 +0200] [1521] [INFO] Handling signal: winch
[2023-04-17 13:58:27 +0200] [1521] [INFO] Handling signal: winch
hannesdatta commented 1 year ago

Errors solved -- it had to do with outdated versions.

Here's my feedback to the Flask app:

image image image image

user pages

image image image

artist page

image

landing page

image image image image

search page

image
thierrylahaije commented 1 year ago

Most issues mentioned above are now done. Only 3 points remaining for the user page, 1 point for the landing page, which need to be discussed before I can continue working on the application. After this, I can fix the mobile design for the application. Then all issues have been fixed and the Flask Application is complete.

thierrylahaije commented 1 year ago

All the remaining issues about the front-end of the Flask App have now been tackled. I took care of the following:

@hannesdatta Please take a look at the front-end and let me know if everything is now as expected.

hannesdatta commented 1 year ago

Open issues followed up in #20. Closing this for now. Good job on many details here!