Which folder for the Flask application is divided into modules?

I am experimenting with Flask from Django and I really like it. There is only one problem that I have encountered. I read documents with jars and part about large applications or something like that, and explains how to separate a project in packages, each of which has its own static and template folder, as well as its own presentation module. the fact is, I can’t find a way that works to place models there using SQLAlchemy with the Flask extension. It works from an interactive prompt to create tables, but when I use it inside the code, it breaks. So I wanted to know how experienced Flask developers did it.

+15
python flask flask-sqlalchemy
May 22 '11 at 15:47
source share
2 answers

While I am not ready to announce, because I am still actively working on refinement of samples, you are likely to benefit from the flask-skeleton project that I am developing. I was tired of reinventing the wheel regarding Flask boot sites, so I started a complete sample project that uses my best practices. I haven't added any unit tests yet, but this should be good enough for you. Please send me feedback or suggestions if you come across them.

https://github.com/sean-/flask-skeleton/

+13
May 22 '11 at 18:34
source share
β€” -

In fact, I found out what I was looking for. Instead of importing flaskext.sqlalchemy on the main __init__ you import it into the model. After that, you import the model into the main __init__ and with db.init_app () run it and pass the application configurations. This is not as flexible as the skeleton shown on the @Sean post, but this is what I wanted to know. If I were not going around, perhaps the skeleton would be the one I would use.

+4
May 22 '11 at 23:52
source share



All Articles