Git Product home page Git Product logo

sample-flask-htmlx's Introduction

Open-Source sample that uses Flask and HTMLx for the frontend logic. For newcomers, Flask is a leading web framework powered by Python and HTMLx is a lightweight JS utility library that allows accessing AJAX, CSS Transitions, WebSockets, and Server-Sent Events directly in HTML.


Features

  • Up-to-date Dependencies
  • Tech Stack:
    • Flask: manages authentication and routing
    • HTMLx: manages forms submit (no JS)
  • Auth: Sign IN, Sign UP
  • Misc: SQLite DB, SQLAlchemy, Forms Validation

Links


Flask HTMLx Sample - Open-Source Sample provided by AppSeed


โœจ Prerequisites

To get started with the application in the machine

  • Python3 - Make sure python3 and highr=er is installed on your system before proceeding to installation instructions.
  • Git - Download and install Git.OSX and linux comes preinstalled with Git. Download and install Git in your windows machine if not installed yet.
  • Pip - We will use pip to install required packages to be used in the project.

โœจ Installation

๐Ÿ‘‰ Step 1 - Cloning the repository.

$ git clone [email protected]:app-generator/sample-flask-htmlx.git 
// OR via HTTPS
$ git clone https://github.com/app-generator/sample-flask-htmlx.git

๐Ÿ‘‰ Step 2 - Prepare Environment (create virtual environment)

$ # Virtualenv modules installation (Unix based systems)
$ virtualenv env
$ source env/bin/activate
$
$ # Virtualenv modules installation (Windows based systems)
$ # virtualenv env
$ # .\env\Scripts\activate

๐Ÿ‘‰ Step 3 - Install Dependencies

$ # Install requirements
$ pip3 install -r requirements.txt

๐Ÿ‘‰ Step 4 - Create Database

$ flask shell    # launch Flask Shell
>>> 
>>> from app import db
>>> db.create_all()

๐Ÿ‘‰ Step 4 - Create Database

$ flask run

๐Ÿ‘‰ Step 5 - Start the APP

$ flask run

The app should be up & running on address http://localhost:5000


โœจ HTMLx

All forms managed by the app use HTMLx directives. Here is the Login Form Source Code and used HTMLx directives:


    <form  hx-swap="outerHTML" 
           hx-post="{{ url_for('auth.signin') }}" 
           hx-push-url="true" 
           hx-target=".content" 
           class="p-5 bg-white shadow mh-100 col-sm-8 col-md-6 col-lg-4" novalidate >
        
        <p class="h3 text-center p-2">SignIn</p>
        
        <!-- Truncated content -->

        <div class="form-input p-1">
            {{form.email.label}}
            {{form.email(class_="form-control")}}
        </div>

        <div class="form-input p-1">
            {{form.password.label}}
            {{form.password(class_="form-control")}}
        </div>

        <button class="btn p-2 px-3 rounded btn-primary h1" type="submit">Sign In</button>
    </form>


Flask HTMLx Sample - Open-Source Sample provided by AppSeed

sample-flask-htmlx's People

Contributors

app-generator avatar b3nhard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.