Giter Site home page Giter Site logo

angelmunoz / flask-minimal-skeleton Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 1.0 3.42 MB

A Flask minimal Skeleton with JWT authentication and some basic auth endpoints

License: MIT License

Python 37.35% JavaScript 28.58% HTML 32.18% CSS 0.53% Shell 1.36%
flask mongoengine flask-mongoengine flask-jwt-extended python rest-api aurelia bulma

flask-minimal-skeleton's Introduction

Minimal Flask Skeleton

This is a fairly small Flask skeleton that includes an auth blueprint with minimal details using MongoEngine (using flask-mongoengine) and MongoDB as a database engine

  • Login
  • SignUp
  • Protected

It uses JWT authentication so it's already suited for RESTful API development to create a new module (blueprint) create a directory, put an __init__.py inside, add your controller.py (tipically called routes in other flask apps) insert at least the following lines

from flask import Blueprint
# <blueprint_name> = Blueprint('<blueprint_name>', __name__)
users = Blueprint('users', __name__)

@users.route('/')
def hello_users():
    """
    http://host:port/users
    (after you include your prefix in app/__init__.py)
    """
    return "Hello Users"

and inside app/__init__.py add the following lines

from app.auth.controller import auth
from app.users.controller import users # this one
# register blueprints
app.register_blueprint(auth, url_prefix='/auth')
# http://host:port/users
app.register_blueprint(users, url_prefix='/users') # this one

feel free to clone and add more stuff as your app grows. if you feel I'm missing something, please send a pull request or raise an issue in github. this repo was built from this previous project.

to have the best experience developing this skeleton you should be using the following

pipenv --three # creates a python 3 virtualenv
pipenv install

press F5

set a breakpoint and send a request

or just run

$ pipenv shell
(virtualenv) $ python app.py

and don't forget to update your custom variables in the .env file

FLASK_APP=app.py
FLASK_ENV=development
DATABASE_URL=mongodb://localhost:27017/vendutron
SECRET_KEY=2c997eed5386cde72187fe8e4f05505b0057c2530993214464824666c02081e0 # use your own
FLASK_DEBUG=True
DEBUG=True

if you intend to publish this repo else were remember to put .env file outside github I left it here for completeness

Client

This sample also Includes an Aurelia Frontend, via aurelia-script, no need to build just go there and edit the files and it will work propperly

flask-minimal-skeleton's People

Contributors

angelmunoz avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jbvill

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.