Answer the question
In order to leave comments, you need to log in
Django vs Flask? for a beginner, and not quite standard tasks?
Gentlemen, after some time studying python, I came to delve into the web component for the time being, and the question arose of choosing a framework. Actually, I'm not interested in "standard" sites, like a blog or a news site. Rather, web applications are more interested - something more custom. Actually the question is which framework is better to take as a basis for these purposes. With a normal ORM for example (which could be extended to fit your needs). In django, for example, I like its modularity, is it possible to correctly implement something similar in flask? Just after some study of this topic, the gut tells you to choose flask. But I would like to hear the opinion of someone who has experience in this matter? Thank you.
Answer the question
In order to leave comments, you need to log in
Pyramid
A very modular framework with a flexible system of settings.
You can easily write RBAC or use a regular ACL . SQLAlchemy
can be used out of the box when creating
. MongoDB and CauchDB are also easily connected out of the box.
For templating, you can connect Chameleon, Jinja2, Mako.
The most interesting thing is that this Framework allows you to do anything and provides a simple system for working with requests and maintaining security.
And of course Python 3
__init__.py is supported
from pyramid.config import Configurator
def main(global_config, **settings):
config = Configurator(settings=settings) # читаем настройки из paste-deploy ini файла
config.include('pyramid_chameleon') # подключаем шаблонизатор
config.add_static_view('static', 'static', cache_max_age=3600) # указываем папку для статики
config.add_route('home', '/') # добавляем роут
config.scan()
return config.make_wsgi_app()
from pyramid.view import view_config
from pyramid.response import Response
# указываем, что данная функция является обработчиком роутинга и выбираем шаблон
@view_config(route_name='home', renderer='templates/mytemplate.pt')
def my_view(request):
# Response(status_int=403)
return {'project': 'MyProject'}
In general, what is better than Django or Flask is a matter of religion :). Personally, I prefer Flask. Many people do not like that it is not modular by default, so no one bothers to make it modular either manually or using blueprint. For ORM, you can use SQLAlchemy. For the Jinja2 template engine. For everything else, this framework has a bunch of extentions. Yes, some components are not in the box and they must be installed separately, but personally I do not see any problems in typing pip install <module_name>. In addition, there is a big plus in the fact that many components are developed by independent teams, which means that if there is a bug in the component, it will most likely be fixed quickly, and in frameworks where all the batteries are inside, you will have to wait for the release of a new version.
As for me, Django needs to be known by default, and then everything else. From a bunch of libs for Flask, you can rivet the same Django, but it's crooked and not convenient.
At one time I spent a lot of time studying Pyramid. Completed several orders that I found through a permanent place of work. Recently, I began to look at freelance (Odesk) and was very disappointed. Two-thirds of web python requests are Django, the remaining third are Flask. I have never met a mention of Pyramid. Therefore, if you are interested in freelancing in the future, I recommend trying Django.
Flask is relatively beautiful, but not very useful. This is a framework in which there is nothing. I don't know how this can be a plus, it's almost like writing in pure PHP. It is possible, but why?
Django is a powerful framework with a lot of built-in features and even more third-party libraries.
I don't see any reason to use Flask.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question