Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flask or Django?
#1
This is a general question so I don't want to open it on Web dev subforum.
So I'm thinking between starting to learn one of these two frameworks.

Flask:
Easier to learn ( as many say) BUT demand for that framework in the local market is equal to zero. Noone wants flask developers here, I didn't see a single job advert in my country.

Django:
Harder to learn ( as many say ) but there is a decent number of job offers for that framework in the local market.

What would you do in my place? I have some doubts about my ability to learn more complex stuff, not sure what to do.
Reply
#2
I would start with flask. If afterwords you want to delve into Django, go ahead.

PS this is more a discussion, so i moved it to news and discussions. But if you had posted in web dev, i wouldnt of moved it either.
Recommended Tutorials:
Reply
#3
Thank you, will definitely start with flask. Saw a youtube tutorial on some other thread.
Reply
#4
One quick question - do I need bootstrap in addition to flask? I see that Corey Schafer uses it a lot in his videos. It looks like CSS framework. Then I guess I'll have to refresh my memory on HTML&CSS first.
Reply
#5
(Jul-04-2019, 10:14 PM)Truman Wrote: do I need bootstrap in addition to flask?
No you do need to use it,optional choice as most with Flask,it can help so you don't need to write all HTML/CSS yourself.

(Jul-04-2019, 10:14 PM)Truman Wrote: Then I guess I'll have to refresh my memory on HTML&CSS first.
It's the other way around Confused
As mention over,so is a lot of HTML/CSS is already written and ready to use in these CSS framework.
I like Bulma which is the same category as BootStrap.

Have to remember that is pretty most a requirement today that web/app-site has to be Responsive.
So if not work with CSS often it's easy step wrong,CSS frameworks has Grid for this build,so it look good on all devices and resolution.
Reply
#6
Bulma looks interesting. Thank you, will take a look at some phase of my learning.

now comparing github pages (Bootstrap Vs Bulma) I spotted that Bootstrap has more detailed and structured files
https://github.com/twbs/bootstrap/tree/master/scss
vs
https://github.com/jgthms/bulma/tree/master/css

I guess that for me as a beginner it would be easier to find what I need from the first link
Reply
#7
(Jul-04-2019, 11:42 PM)Truman Wrote: now comparing github pages (Bootstrap Vs Bulma) I spotted that Bootstrap has more detailed and structured files
It's not about structure of files at all,you will never use these files directly.
I think you struggle with the basic understanding and usage here.

When use these framework you use documentation,so if make something quick like this Pen
Here use i both Bulma and Boostap together,layout(Grid) is Bulma.
So in doc there is code Bumla(code) Bootstrap(code) that as example can be copied over and used in your web/app-site.
Reply
#8
Alright, so I should copy the code from the documentation, not from github.
Reply
#9
(Jul-05-2019, 11:27 AM)Truman Wrote: Alright, so I should copy the code from the documentation, not from github.
Yes.

If want to run code i have in CodePen in Flask.
Folder setup:
codepen\
  |--app.py
  templates\
    |-- index.html
# app.py
from flask import Flask, render_template, jsonify
 
app = Flask(__name__)
@app.route('/')
def index():
   return render_template("index.html")

if __name__ == '__main__':
   app.run(debug=True)
index.html
See that i have to link to Bulma and Bootstrap,CodePen is doing this internally.
<!doctype html>
<html>
<head>
  <meta charset="UTF-8">
  <title>CodePen - Bulma demo with Bootstrap</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css">
</head>
  <body>
    <div class="container is-widescreen">
      <div class="column">
        <h2 class="subtitle">Bulma buttons</h2>
        <a class="button is-focused">Focus</a>
        <a class="button is-primary is-focused">Focus</a>
        <a class="button is-link is-focused">Focus</a>
        <a class="button is-info is-focused">Focus</a>
        <a class="button is-success is-focused">Focus</a>
        <a class="button is-warning is-focused">Focus</a>
        <a class="button is-danger is-focused">Focus</a>
      </div>
    </div>
    <div class="container is-widescreen">
      <div class="column">
        <h2 class="subtitle">Bootstrap button</h2>
        <button type="button" class="btn btn-primary">Primary</button>
        <button type="button" class="btn btn-secondary">Secondary</button>
        <button type="button" class="btn btn-success">Success</button>
        <button type="button" class="btn btn-danger">Danger</button>
        <button type="button" class="btn btn-warning">Warning</button>
        <button type="button" class="btn btn-info">Info</button>
        <button type="button" class="btn btn-light">Light</button>
        <button type="button" class="btn btn-dark">Dark</button>
        <button type="button" class="btn btn-link">Link</button>
      </div>
    </div>
    <div class="container is-widescreen">
      <div class="column">
        <h2 class="subtitle">Bulma progress bar</h2>
        <progress class="progress is-small is-primary" max="100">15%</progress>
        <progress class="progress is-danger" max="100">30%</progress>
        <progress class="progress is-medium is-dark" max="100">45%</progress>
        <progress class="progress is-large is-info" max="100">60%</progress>
  </body>
</html>
Reply
#10
Hi,

@Truman: focus on learning the web framework and forget for the moment about the CSS. The CSS is on the client side anyway and integrating a CSS framework into a template is more or less the same for all template engines.

What you should learn depends on what you want to do later. THE benefit of Django is the tight integration of all components, which allows to write high level code (=fewer lines).

However, I think it's beneficial to basically understand how WSGI works, which is more obvious on Flask.

I personally started with Bottle (Flask didn't exist at the time :-) ) and added Wtforms and SQLAlchemy. I moved later to Django because of the better integration of ORM, forms etc.

When using Django and Django's CBS (class-based views) it is imperative to have a basic understand of Python's object orientation and how Python does classes. Otherwise, it's difficult to get your head around what Django is doing.

Last advise for the moment: learn Flask (or Django) by walking through their official documentation and tutorials. They are error-free and show idiomatic code. Which is not necessarily the case for other videos and tutorials. Yes, of course there are good ones, too - but how do you know as a beginner?

Regards, noisefloor
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Flask or Django: Which Framework Support Database? ankitdixit 2 1,151 Jun-02-2022, 06:11 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020