U
U
un1t2012-11-15 16:02:09
Flask
un1t, 2012-11-15 16:02:09

General questions about Flask?

I have been using Django for a long time, but for one of the projects I decided to try Flask (along with MongoDB). In connection with what questions.
1. Image resizing. Is there something similar to sorl in Django? or it may not be the same.
2. In jang there is such a handy thing as custom template tags. In the flask, I see only context processors. Of course, they can be used, but even so they have a different purpose, at least in Dzhang.
3. How it is customary to release common elements that are used on many pages of the site. For example menu.
4. I would be glad to see a list of standard "batteries" for Flask (commonly used common libraries) - admin panel, authorization, previews, and more. What do you usually use in projects?
5. Does it make sense to use Flask on large projects?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
nimnull, 2012-11-15
@nimnull

1. a) The sorl code is a little more than half an example of how not to write in python. b) When we had a similar question in our team, I did not find solutions for our task, as a result, we took the basic functionality of sorl, slightly rewrote image processing and api and got ourselves a separate blueprint that resizes and caches images.
2. Jinja is also extensible, but the code will be more complicated than in django templates. For all sorts of little things, you can add your own methods to jinja_env.globals.
3. Jinja has support for macros. In general, most of these things are done through them.
4. Batteries on pypi or separately
5. The controversial question, what is considered a big project? How to organize architecture? Etc. Are you ready to write something familiar in the django world from scratch?

Z
zasqer, 2014-08-06
@zasqer

4) regarding batteries:
Flask-Login is an analog of Django's User model.
Flask-SQLAlchemy is an analogue of Django ORM, only cooler, although it is a little more difficult to connect.
Flask-WTF is an analogue of Django Forms, I'm not sure which is better.
Flask-Script is an analogue of Django manage.py, which you need to finish yourself, but I like it.
Flask-Admin is an analogue of the Django admin panel, very simple. Here Django is head and shoulders above.
Flask-Restless - to create a REST API, I didn’t use an analogue from Django, I can’t compare.
Flask-DebugToolbar is similar to the Django debug toolbar, but simpler.
Also, Armin Ronacher is doing https://github.com/pocoo/metaflask , a project that should clean up the Flask ecosystem a bit. Still in development.
If anyone knows and used travel extensions for testing and integration with social networks - write pliz here in the comments.

P
Pavel Tyslyatsky, 2012-11-15
@tbicr

I can’t call myself a django or flask expert, but:
It seems that there is a lot of info in the dock on the site (which is read very quickly, literally in a day or two, if you missed something).
1. I don’t know exactly how sorl works, but if images are generated on the fly on request, then you may need to look at the capabilities of the template engine and its extensions
2. Flask uses the jinja2 template engine by default , which allows you to write catatom tags, in general, the question is more about jinja2
3. In my opinion, this is implemented using templates (jinja2) and inheritance , or include , or custom tags
4. It seems that there is something on the off site: flask.pocoo.org/extensions/
5. Why not, what are the concerns?

G
gelas, 2012-11-15
@gelas

2. There are also extensions in jinja2 to create your own tags

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question