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

fix: Stable build in app/base/models.py #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tumble17
Copy link

Migrated models.py to flask-sqlalchemy data structures

This PR uncovered an error with the app/base/models.py when trying to run the build instructions.

The script was trying to make use of sqlalchemy structure: Binary, Column, Integer, String. Few different ways to tackle this issue, such as importing sqlalchemy itself, but making use of the available imports was chosen to reduce changed touchpoints. Data structures are available through the db, which is created in the init script.

Tested locally and results in a stable run. Hopefully you agree and we can update this file to allow this repo to be used easily.

Please let me know if you want to change anything to align to your ways of working and standards, I cannot see a contribution file.

Migrated models.py to flask-sqlalchemy data structures
@Tumble17
Copy link
Author

@timcreative @marqbeniamin @alexandru-paduraru @dragosct10

Hey, please can I get help with this review, not able to assign you directly. Attaching all names I can see on contributions list.

@app-generator
Copy link
Collaborator

Hello @Tumble17,

Thank you for your contribution. The patch looks good and probably we will merge it after a few tests.

Can you provide more information regarding the runtime errors?
(OS version, error log, or just a simple test case to follow)

All Flask/Django kits are cross-tested on WIndows, RHEL, and Debian distros (LTS versions).

P.S. Let us know if we can reward in some way your effort.

@Tumble17
Copy link
Author

Hey,

Thanks for coming back so quick and great to hear. If there's a next time, I'll get you this info ahead of time:

I'm testing locally on Mac OS Catalina 10.15.7.

Everything works as shown in the README.md until the final run command:

flask run --host=0.0.0.0 --port=5000

That returns the following stack trace:

Error: While importing "run", an ImportError was raised:

Traceback (most recent call last):
  File "/Users/jack.dyer/github/material-dashboard-flask/.venv/lib/python3.9/site-packages/flask/cli.py", line 240, in locate_app
    __import__(module_name)
  File "/Users/jack.dyer/github/material-dashboard-flask/run.py", line 29, in <module>
    app = create_app( app_config )
  File "/Users/jack.dyer/github/material-dashboard-flask/app/__init__.py", line 39, in create_app
    register_blueprints(app)
  File "/Users/jack.dyer/github/material-dashboard-flask/app/__init__.py", line 22, in register_blueprints
    module = import_module('app.{}.routes'.format(module_name))
  File "/usr/local/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Users/jack.dyer/github/material-dashboard-flask/app/base/routes.py", line 17, in <module>
    from app.base.models import User
  File "/Users/jack.dyer/github/material-dashboard-flask/app/base/models.py", line 7, in <module>
    from sqlalchemy import Binary, Column, Integer, String
ImportError: cannot import name 'Binary' from 'sqlalchemy' (/Users/jack.dyer/github/material-dashboard-flask/.venv/lib/python3.9/site-packages/sqlalchemy/__init__.py)

Traced that directly to the file in question, made the commit in this PR and the same step ran through as expected and could use the dashboard on 0.0.0.0:5000.

As for reward, I'm not sure what you might feel is appropriate and was very happy to help. I am an active user of your products; think they're beautifully designed. If there're any premium products you would be happy to give me access to that would be a superb exchange. Very open to other suggestions!

Best,

Tumble

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

Successfully merging this pull request may close these issues.

None yet

2 participants