GithubHelp home page GithubHelp logo

youngsoul / flask_starter Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 2.0 25.91 MB

Simple Flask Starter project with a login using a Creative Tim Bootstrap Template

Python 2.35% CSS 56.52% JavaScript 8.89% HTML 25.89% Roff 6.34%

flask_starter's Introduction

Flask Starter

This project will be a starter project using Flask and creative-tim.com themes called:

Get SH IT done

Paper Kit 2

Paper Dashboard 2

This project will use flask-login, blueprints for a basic starter with a login and a landing page. It will not use a database but this can be added later.

When you navigate to the index page: localhost:5000 if you are running a typical flask web server, if you are not logged in you will be redirected to the login page. Once logged in you are navigated back to the index page.

From the index page, you are able to transition to another page, served from another blueprint. Just a simple way to show navigating between blueprints and to make sure the static url resolution was working.

Features

  • Login required
  • Role based access of routes
  • Protected routes
  • Simple navigation between pages
  • Integration with Vue.js and axios (Paper Dashboard2)

Paper Dashboard 2

This template has Vue.js integrated into it and Axios for remote Ajax calls to the Flask server. The Vue.js integration is a light integration at the Jinja template level. It is meant to be a very light touch way to get the benefits of Vue.js while still leverage the more traditional Jinja template approach.

Assumptions

  1. Python3 is installed

Setup and Install

The flask_starter project uses a number of different python packages. The best way to install everything is the following:

  1. cd to directory where you want to hold the project
  2. git clone https://github.com/youngsoul/flask_starter
  3. cd flask_start
  4. python3 -m venv venv
  5. source venv/bin/activate
  6. pip install -r requirements.txt

Run

To start the server. python main.py

Themes

This project has three CreativeTim (www.creative-tim.com) themes that can be used.

In config.py there are three configuration parameters to set the theme:

CONTENT_DIR This is the name of the content directory that will be in templates and static.

Changing the value of the CONTENT_DIR will automatically update the STATIC_PATH and TEMPLATES_DIR.

The current values are one of:

    #CONTENT_DIR = 'get-shit-done-1.4.1'
    #CONTENT_DIR = 'pk2-free-v2'
    #CONTENT_DIR = 'paper-dashboard-2'

STATIC_PATH

TEMPLATES_DIR

STATIC_PATH is the relative path to the static files, for example, static/pk2-free-v2

TEMPLATES_DIR is the relative pat to the template files, for example, templates/pk2-free-v2

Changing these config properties will change the themes used by the application.

Creative Tim Template Updates

Html Updates

  • where you see:

href="assets/img/apple-icon.png"

Change this to use the url_for, for the 'static' folder

href="{{ url_for('static', filename='assets/img/apple-icon.png') }}

or, notice the url method around the jinja url_for,

... style="background-image: url( {{ url_for('static', filename='assets/img/cover_4.jpg', _external=True) }} )">

html_to_jinja.py

This script is a helper script to convert some of the urls, links, img srcs to using Flasks, url_for(). It might not get everything, but it convert a lot of hrefs to use the url_for static resources.

To use this script, open the html_to_jinja.py and look for the variable tim_files and change the path to the root of the html themed files.

Users

This flask starter does not use a database, but the users are defined in config.py

TODOs

[] Finish remaining pages for Paper Dashboard 2
[] Create an Admin page for Paper Dashboard 2
[] Add logout to Paper Dashboard 2
[] Add read data connections to Paper Dashboard 2

Get SH IT Done Landing Page Screen Capture

Get SH IT Done

Paper Kit 2 Landing Page Screen Capture

Paper Kit 2

Paper Dashboard 2 Landing Page Screen Capture

Paper Dashboard 2

flask_starter's People

Contributors

spr-pat-ryan avatar youngsoul avatar

Stargazers

 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.