Giter Site home page Giter Site logo

flask's Introduction

flask

Basic knowladge about flask and some bootstrap. Simple project.

tutorial created by Jim from JimShapedCoding https://www.youtube.com/watch?v=Qr4QMBUPxWo

flask documentation https://flask.palletsprojects.com/en/2.1.x/

  1. py -3 -m venv <name_environment> >> new virtual environment python3 -m venv <name_environment>

  2. <name_environment>/bin/activate >> linux <name_environment>\Scripts\activate >> Windows

  3. pip3 install flask pip3 freeze >> requirements.txt installed libraries

  4. quickstart https://flask.palletsprojects.com/en/2.1.x/quickstart/

from flask import Flask

app = Flask(name)

@app.route("/") def hello_world(): return "

Hello, World!

"

  1. export FLASK_APP = name_of_our_file.py >> linux setx FLASK_APP "name_of_our_file.py" >> windows + restart!!

  2. flask run

  3. setx FLASK_DEBUG "1"

Libraries:

  1. sqlalchemy >> bazy from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy(app)
  2. flask_bcrypt >> for passwords https://flask-bcrypt.readthedocs.io/en/1.0.1/
  3. flask_login
  4. flask_wtf > forms >forms.py from flask_wtf import FlaskForm
  5. email_validator

baza In virtualenv:

  1. python
  2. from file import db
  3. db.create_all() >> creates database ussing our class Item(db.Model)
  4. from file import Item >> adds element to our database object = Item(name="laptop, price = 500,..................) db.session.add(object) db.session.commit()
  5. item.query.all() >> displays all element in database

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.