Compare of Django and Bottle - bernardopnunes/SoftwareEngineeringSDUW GitHub Wiki

Group:The Beauties

  • Django
  • Bottle
  • Disadvantages of Django
  • Disadvantages of Bottle
  • Advantages of Django
  • Advantages of Bottle
  • Comparision
  • Summary

Django

Django is Python web framework that encourages rapid development. It is based model-template-view (MTV) design pattern. It follows a "batteries included" philosophy and ships with many tools that are needed by application developers such as ORM framework, admin panel, directory structure and more.

Bottle

Bottle is a fast, simple and lightweight WSGI micro web-framework for Python. It is distributed as a single file module and has no dependencies other than the Python Standard Library. The Bottle framework can be roughly divided into the following parts:Routing, Templates, Utilities, Server.

Disadvantages of Django

Django also has many disadvantages. Not all situations are suitable for Django.

High integration

Django also includes some functional modules that are not needed for lightweight applications. For lightweight development process, it is not as light as flask.

Over encapsulation

Django encapsulates many classes and methods. It can't see the internal code directly. It's easy to use directly, but it's difficult to change.

Performance disadvantage

Compared with the performance of C and C + +, Django has low performance. Of course, this is the impact of Python language. Other Python frameworks will have the same problem when the traffic increases to a large enough size.

Template problem

Django's template realizes complete separation of code and style, and does not allow Python code in the template, which reduces the modifiability of the template. For some programmers, flexibility may not be enough.

Disadvantage of Bottle

One consequence of bottle minimalism is that some functions don’t exist at all. Form validation, including CRSF protection, is not supported. If you want to build web applications that support a high level of user interaction, you need to add them yourself.

Advantages of Django

Django takes care of much of the hassle of Web development.It’s free and open source.

Ridiculously fast

Django was designed to help developers take applications from concept to completion as quickly as possible.

Fully loaded

Django includes dozens of extras you can use to handle common Web development tasks. Django takes care of user authentication, content administration, site maps, RSS feeds, and many more tasks — right out of the box.

Reassuringly secure

Django takes security seriously and helps developers avoid many common security mistakes, such as SQL injection, cross-site scripting, cross-site request forgery and clickjacking. Its user authentication system provides a secure way to manage user accounts and passwords.

Exceedingly scalable

Some of the busiest sites on the planet use Django’s ability to quickly and flexibly scale to meet the heaviest traffic demands.

Incredibly versatile

Companies, organizations and governments have used Django to build all sorts of things — from content management systems to social networks to scientific computing platforms.

Advantage of Bottle

Bottle can be considered as a mini flask because it is more compact and concise than other micro web-framework. Bottle is suitable for inclusion in other projects or for small projects such as REST API and so on. Bottle is a fast, simple and lightweight WSGI micro web-framework for Python. It is distributed as a single file module and has no dependencies other than the Python Standard Library. Bottle does not depend on any external libraries. We can just download bottle.py int our project directory and start coding. If you want a more stable environment, you can install via pip. In pure WSGI, the range of types you may return form your application is very limited. Applications must return an iterable yielding byte strings. You may return a string but this causes most servers to transmit your content char by char. Unicode strings are not allowed at all. This is not very practical. Bottle is much more flexible and supports a wide range of types. It even adds a Content-Length header if possible and encodes Unicode automatically, so you don’t have to.

Comparison

Characteristic Django Bottle
Type Python all-inclusive, megaframework for building web application. Python microframework for building Web applications
Author Adrian Holovaty and Simon Willison. Marcel Hellkamp
Flexibility Django expects things to be done in a certain way which have no opinion on how developers structure things. Very flexible and extremely simple. Doesn't force anything on developers.Just a .py file
RDBMS support ORM is one of the best features of Django, loved by developers. Bottle has no built-in ORM framework. It leaves it up to developers to choose a library like SQLAlchemy or extensions such as Macaron.
REST support REST development is supported via the popular and active Django REST Framework project. Bottle has no built-in support but can be implemented easily.
Security When vulnerabilities are discovered, the Django team has an excellent security policy and fixes are released quickly. Bottle has no built-in protection. Bottle is a minimalist framework. It must be handled by developers themselves or by using 3rd party extensions.
Popularity Very many users, very popular. In terms of quantity, the number of projects using Bottle is smaller than that using Django.
Performance Not as fast as compared to bare-bones Flask or other microframeworks, but for many real-world use cases, the difference is negligible. The performance of the Bottle is very fast.But extensions could have an adverse impact on the performance.But due to its minimal footprint, bottle is ideal for inclusion in other projects or for small projects such as rapid delivery of rest APIs.
Ease of Learning Has a learning curve especially for those who are not familiar with other web frameworks. Straightforward and easy to learn. It has a good amount of tutorials online.

Summary

In fact, bottle is lighter, smaller, easier to get started and accepted by beginners. Bottle does not depend on any third-party python module and is easy to deploy. It has high performance and built-in basic needs for web development request, etc.). In contrast, Django is more suitable for larger projects, which require a lot of back-end and front-end support, or when time plays a key role,for Django provides a large number of ready-made components.